/** * Initialize a new directory entry object for the given id. * * @param string $id directory entry id * @throws InvalidArgumentException if id of directory entry is invalid */ public function __construct($id = null) { parent::__construct($id); if ($id !== null && $this->isNew()) { throw new InvalidArgumentException('directory entry not found'); } }
/** * Give primary key of record as param to fetch * corresponding record from db if available, if not preset primary key * with given value. Give null to create new record * * @param mixed $id primary key of table */ public function __construct($id = null) { $this->db_table = 'seminar_tabs'; $this->belongs_to['course'] = array('class_name' => '\\Course', 'foreign_key' => 'seminar_id'); // workaround for Stud.IP ticket:5312 //$options = $this->getRelationOptions('course'); //$options = $this->getRelationOptions('parent'); /** $this->has_many['children'] = array( 'class_name' => 'Mooc\\DB\\Block', 'assoc_foreign_key' => 'parent_id', 'assoc_func' => 'findByParent_id', 'on_delete' => 'delete', 'on_store' => 'store' ); $this->registerCallback('before_create', 'ensureSeminarId'); $this->registerCallback('before_create', 'ensurePositionId'); $this->registerCallback('before_store', 'validate'); $this->registerCallback('after_delete', 'destroyFields'); $this->registerCallback('after_delete', 'destroyUserProgress'); $this->registerCallback('after_delete', 'updatePositionsAfterDelete'); $events = words('after_create after_update after_store after_delete'); $this->registerCallback($events, 'callbackToMetrics'); **/ parent::__construct($id); }
function __construct($id = null) { $this->db_table = 'blubber_external_contact'; //$this->registerCallback('before_store', 'cbSerializeData'); //$this->registerCallback('after_store after_initialize', 'cbUnserializeData'); parent::__construct($id); }
public function __construct($id = null) { $this->db_table = 'doc_filetype_forbidden'; $this->belongs_to['userConfig'] = array('class_name' => 'DocUsergroupConfig', 'foreign_key' => 'usergroup'); $this->belongs_to['filetype'] = array('class_name' => 'DocFiletype', 'foreign_key' => 'dateityp_id'); parent::__construct($id); }
function __construct($id = null) { if (version_compare($GLOBALS['SOFTWARE_VERSION'], "3.2", "<")) { $this->registerCallback('before_store', 'cbSerializeData'); $this->registerCallback('after_store after_initialize', 'cbUnserializeData'); } parent::__construct($id); }
/** * Constructor of the object. Provides a fallback if a url is passed * instead of the usually expected numeric id in order to not break * backward compatibility. * But this constructor will fail miserably if a url is passed that * is not in the database. This was chosen by design to encourage the * correct use of an id. * * @param mixed $id Numeric id, existing url or null */ public function __construct($id = null) { // Try to find matching id when an url is passed instead of an id. // This is to ensure that no legacy code will immediately break. if ($id !== null && !ctype_digit($id)) { $temp = self::findOneByUrl($id); if ($temp) { $id = $temp->id; } } parent::__construct($id); }
public function __construct($id = null) { $this->db_table = 'doc_filetype'; $this->has_many['forbiddenTypes'] = array( 'class_name' => 'DocFileTypeForbidden', 'on_delete' => 'delete', 'on_store' => 'store', ); parent::__construct($id); }
public function __construct($id = null) { parent::__construct($id); $this->registerCallback('after_store before_delete', function ($notification) { $query = "SELECT user_id\n FROM personal_notifications_user\n WHERE personal_notification_id = :id"; $statement = DBManager::get()->prepare($query); $statement->bindValue(':id', $notification->id); $statement->execute(); $user_ids = $statement->fetchAll(PDO::FETCH_COLUMN); foreach ($user_ids as $user_id) { PersonalNotifications::expireCache($user_id); } }); }
/** * Defines the associated database table, relation to the schedule * and appropriate callbacks to encode/decode a possible exception. * * @param mixed $id Id of the log entry in question or null for a new entry */ public function __construct($id = null) { $this->registerCallback('before_store after_store after_initialize', 'cbSerializeException'); parent::__construct($id); }
function __construct($id = null) { $this->registerCallback('after_store', 'afterStoreCallback'); parent::__construct($id); }
public function __construct($id = null) { $this->db_table = 'doc_usergroup_config'; parent::__construct($id); }
function __construct($id = null) { parent::__construct($id); $this->registerCallback('before_create', 'cbDefaultValues'); }
function __construct($id = array()) { $this->db_table = 'help_tour_audiences'; parent::__construct($id); }
/** * constructor * @param string/null $id : id of blubber-stream */ public function __construct($id = null) { $this->db_table = "blubber_streams"; $this->registerCallback('before_store', 'serializeData'); $this->registerCallback('after_store after_initialize', 'unserializeData'); $this->user_id = $GLOBALS['user']->id; parent::__construct($id); }
function __construct($id = array()) { $this->db_table = 'help_tour_settings'; parent::__construct($id); }
/** * Overrides the contructor of SimpleORMap and is used in the exact same way. * Adds a virtual field to the posting giving the time of the newest comment * to the thread (or the thread.mkdate if no comment exists). * @param null|string $id */ public function __construct($id = null) { $this->additional_fields['discussion_time']['get'] = function ($posting) { if ($posting['topic_id'] === $posting['root_id']) { $db = DBManager::get(); return $db->query("SELECT GREATEST(MAX(blubber.mkdate), IFNULL(MAX(blubber_reshares.chdate), 0)) " . "FROM blubber " . "LEFT JOIN blubber_reshares ON (blubber_reshares.topic_id = blubber.root_id) " . "WHERE root_id = " . $db->quote($posting->getId()) . " " . "GROUP BY blubber.root_id DESC " . "LIMIT 1 " . "")->fetch(PDO::FETCH_COLUMN, 0); } else { return $posting['mkdate']; } }; $this->db_table = "blubber"; $this->registerCallback('after_store', 'synchronizeHashtags'); parent::__construct($id); }
function __construct($id = null) { $this->registerCallback('after_store after_delete', 'cleanUp'); parent::__construct($id); }
/** * The constructor sets the after_initialize callback which will load * the associated php class. */ public function __construct($id = null) { $this->registerCallback('after_initialize', 'loadClass'); parent::__construct($id); }
/** * Defines the associated database table, relations to the task and logs * and appropriate callbacks to encode/decode the parameters. * * @param mixed $id Id of the schedule entry in question or null for a new * entry */ public function __construct($id = null) { $this->registerCallback('before_store after_store after_initialize', 'cbJsonifyParameters'); parent::__construct($id); }
function __construct($id = array()) { $this->db_table = 'help_tour_steps'; $this->belongs_to = array('help_tour' => array('class_name' => 'HelpTours', 'foreign_key' => 'tour_id')); parent::__construct($id); }
public function __construct($id = null) { $this->registerCallback('before_store', 'requestReview'); parent::__construct($id); }
/** * Extended SimpleORMap constructor. A certain user can be injected upon * creation. * * @param mixed $id Id of the consumer or null to create a new one * @param mixed $user Either a user object or id to inject to the consumer * or null if no user should be injected */ public function __construct($id = null, $user = null) { $this->db_table = 'api_consumers'; parent::__construct($id); if ($user !== null) { $this->setUser($user); } }
function __construct($id = null) { parent::__construct($id); $this->registerCallback('before_create', 'cbDefaultValues'); $this->registerCallback('after_store', 'cbUpdateConnectedContentModules'); }
function __construct() { parent::__construct(null); }
function __construct($id = null) { $this->registerCallback('before_store', 'cbSerializeData'); $this->registerCallback('after_store after_initialize', 'cbUnserializeData'); parent::__construct($id); }