/** * The constructor. Creates a seminar instance from a DB record. * * By default, the process of creating a seminar object from a hidden record * fails. If we need the seminar object although it's hidden, the parameter * $allowHiddenRecords should be set to TRUE. * * @param int $uid UID of the seminar to retrieve from the DB. This parameter will be ignored if $dbResult is provided. * @param resource|boolean $dbResult MySQL result pointer (of SELECT query). If this parameter is provided, $uid will be ignored. * @param bool $allowHiddenRecords whether it is possible to create a seminar object from a hidden record */ public function __construct($uid, $dbResult = FALSE, $allowHiddenRecords = FALSE) { parent::__construct($uid, $dbResult, $allowHiddenRecords); // For date records: Create a reference to the topic record. if ($this->isEventDate()) { $this->topic = $this->retrieveTopic(); // To avoid infinite loops, null out $this->topic if it is a date // record, too. Date records that fail the check isTopicOkay() // are used as a complete event record. if ($this->isTopicOkay() && $this->topic->isEventDate()) { $this->topic = NULL; } } else { $this->topic = NULL; } }
/** * Limits the bag to date event records of the same topic as the event * given in the first parameter $event. * * @param tx_seminars_seminar $event the date or topic object to find other dates of the same topic for * * @return void */ public function limitToOtherDatesForTopic(tx_seminars_seminar $event) { if (!$event->isEventDate() && !$event->isEventTopic()) { throw new InvalidArgumentException('The first parameter $event must be either a date or a topic record.', 1333292764); } $this->whereClauseParts['other_dates'] = '(' . 'tx_seminars_seminars.topic = ' . $event->getTopicUid() . ' AND object_type = ' . tx_seminars_Model_Event::TYPE_DATE . ' AND uid <> ' . $event->getUid() . ')'; }