/** * Get the associated ChildRights object * * @param ConnectionInterface $con Optional Connection object. * @return ChildRights The associated ChildRights object. * @throws PropelException */ public function getRights(ConnectionInterface $con = null) { if ($this->aRights === null && $this->_rightid !== null) { $this->aRights = ChildRightsQuery::create()->findPk($this->_rightid, $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->aRights->addRRightsFortemplates($this); */ } return $this->aRights; }
/** * Returns a new ChildRightsQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildRightsQuery */ public static function create($modelAlias = null, Criteria $criteria = null) { if ($criteria instanceof ChildRightsQuery) { return $criteria; } $query = new ChildRightsQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Gets the number of Rights objects related by a many-to-many relationship * to the current object by way of the R_rights_fortemplate cross-reference table. * * @param Criteria $criteria Optional query object to filter the query * @param boolean $distinct Set to true to force count distinct * @param ConnectionInterface $con Optional connection object * * @return int the number of related Rights objects */ public function countRightss(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collRightssPartial && !$this->isNew(); if (null === $this->collRightss || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRightss) { return 0; } else { if ($partial && !$criteria) { return count($this->getRightss()); } $query = ChildRightsQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query->filterByTemplatenames($this)->count($con); } } else { return count($this->collRightss); } }
/** * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless * of whether or not they have been modified. * * @throws LogicException if no primary key is defined * * @return Criteria The Criteria object containing value(s) for primary key(s). */ public function buildPkeyCriteria() { $criteria = ChildRightsQuery::create(); $criteria->add(RightsTableMap::COL_ID, $this->id); return $criteria; }