*
* @see DB_DataObject
*/
-
class Notice_title extends Memcached_DataObject
{
const MAXCHARS = 255;
* @return Notice_title object found, or null for no hits
*
*/
-
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Notice_title', $k, $v);
*
* @return array array of column definitions
*/
-
function table()
{
return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
*
* @return array list of key field names
*/
-
function keys()
{
return array_keys($this->keyTypes());
/**
* return key definitions for Memcached_DataObject
+ *
+ * @return array list mapping field names to key types
*/
-
function keyTypes()
{
return array('notice_id' => 'K');
*
* @return array magic three-false array that stops auto-incrementing.
*/
-
function sequenceKey()
{
return array(false, false, false);
}
+
+ /**
+ * Get a notice title based on the notice
+ *
+ * @param Notice $notice Notice to fetch a title for
+ *
+ * @return string title of the notice, or null if none
+ */
+ static function fromNotice($notice)
+ {
+ $nt = Notice_title::staticGet('notice_id', $notice->id);
+ if (empty($nt)) {
+ return null;
+ } else {
+ return $nt->title;
+ }
+ }
}