/** * Gets the number of Books objects related by a many-to-many relationship * to the current object by way of the R_templatenames_forbook 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 Books objects */ public function countBookss(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collBookssPartial && !$this->isNew(); if (null === $this->collBookss || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collBookss) { return 0; } else { if ($partial && !$criteria) { return count($this->getBookss()); } $query = ChildBooksQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query->filterByTemplatenames($this)->count($con); } } else { return count($this->collBookss); } }
/** * Get the associated ChildBooks object * * @param ConnectionInterface $con Optional Connection object. * @return ChildBooks The associated ChildBooks object. * @throws PropelException */ public function getBooks(ConnectionInterface $con = null) { if ($this->aBooks === null && $this->_bookid !== null) { $this->aBooks = ChildBooksQuery::create()->findPk($this->_bookid, $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->aBooks->addRRightsForbooks($this); */ } return $this->aBooks; }
/** * 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 = ChildBooksQuery::create(); $criteria->add(BooksTableMap::COL_ID, $this->id); return $criteria; }