/** * Get the associated SystemEventInstance object * * @param PropelPDO $con Optional Connection object. * @return SystemEventInstance The associated SystemEventInstance object. * @throws PropelException */ public function getSystemEventInstance(PropelPDO $con = null) { if ($this->aSystemEventInstance === null && $this->system_event_instance_id !== null) { $this->aSystemEventInstance = SystemEventInstanceQuery::create()->findPk($this->system_event_instance_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aSystemEventInstance->addSystemEventInstanceMessages($this); */ } return $this->aSystemEventInstance; }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @throws Exception * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(SystemEventInstancePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = SystemEventInstanceQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseSystemEventInstance:delete:pre') as $callable) { if (call_user_func($callable, $this, $con)) { $con->commit(); return; } } if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseSystemEventInstance:delete:post') as $callable) { call_user_func($callable, $this, $con); } $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this SystemEvent is new, it will return * an empty collection; or if this SystemEvent has previously * been saved, it will retrieve related SystemEventInstances from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in SystemEvent. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelObjectCollection|SystemEventInstance[] List of SystemEventInstance objects */ public function getSystemEventInstancesJoinUser($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = SystemEventInstanceQuery::create(null, $criteria); $query->joinWith('User', $join_behavior); return $this->getSystemEventInstances($query, $con); }