/** * Returns a new CausadiferidoQuery object. * * @param string $modelAlias The alias of a model in the query * @param CausadiferidoQuery|Criteria $criteria Optional Criteria to build the query from * * @return CausadiferidoQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof CausadiferidoQuery) { return $criteria; } $query = new CausadiferidoQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Get the associated Causadiferido object * * @param PropelPDO $con Optional Connection object. * @return Causadiferido The associated Causadiferido object. * @throws PropelException */ public function getCausadiferido(PropelPDO $con = null) { if ($this->aCausadiferido === null && $this->causa_diferido_id !== null) { $this->aCausadiferido = CausadiferidoQuery::create()->findPk($this->causa_diferido_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->aCausadiferido->addAgendas($this); */ } return $this->aCausadiferido; }
/** * Deletes all descendants for the given node * Instance pooling is wiped out by this command, * so existing Causadiferido instances are probably invalid (except for the current one) * * @param PropelPDO $con Connection to use. * * @return int number of deleted nodes */ public function deleteDescendants(PropelPDO $con = null) { if ($this->isLeaf()) { // save one query return; } if ($con === null) { $con = Propel::getConnection(CausadiferidoPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $left = $this->getLeftValue(); $right = $this->getRightValue(); $scope = $this->getScopeValue(); $con->beginTransaction(); try { // delete descendant nodes (will empty the instance pool) $ret = CausadiferidoQuery::create()->descendantsOf($this)->delete($con); // fill up the room that was used by descendants CausadiferidoPeer::shiftRLValues($left - $right + 1, $right, null, $scope, $con); // fix the right value for the current node, which is now a leaf $this->setRightValue($left + 1); $con->commit(); } catch (Exception $e) { $con->rollback(); throw $e; } return $ret; }