/** * Removes this object from datastore and sets delete attribute. * * @param ConnectionInterface $con * @return void * @throws PropelException * @see Questions::setDeleted() * @see Questions::isDeleted() */ public function delete(ConnectionInterface $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getServiceContainer()->getWriteConnection(QuestionsTableMap::DATABASE_NAME); } $con->transaction(function () use($con) { $deleteQuery = ChildQuestionsQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $this->setDeleted(true); } }); }
/** * Returns a new ChildQuestionsQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildQuestionsQuery */ public static function create($modelAlias = null, Criteria $criteria = null) { if ($criteria instanceof ChildQuestionsQuery) { return $criteria; } $query = new ChildQuestionsQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Get the associated ChildQuestions object * * @param ConnectionInterface $con Optional Connection object. * @return ChildQuestions The associated ChildQuestions object. * @throws PropelException */ public function getQuestions(ConnectionInterface $con = null) { if ($this->aQuestions === null && ($this->question_id !== "" && $this->question_id !== null)) { $this->aQuestions = ChildQuestionsQuery::create()->findPk($this->question_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->aQuestions->addExpertQuestionStates($this); */ } return $this->aQuestions; }