/** * 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 = ChildSubcategoriesQuery::create(); $criteria->add(SubcategoriesTableMap::COL_SUBCATEGORY_ID, $this->subcategory_id); return $criteria; }
/** * Get the associated ChildSubcategories object * * @param ConnectionInterface $con Optional Connection object. * @return ChildSubcategories The associated ChildSubcategories object. * @throws PropelException */ public function getSubcategories(ConnectionInterface $con = null) { if ($this->aSubcategories === null && $this->subcategory_id !== null) { $this->aSubcategories = ChildSubcategoriesQuery::create()->findPk($this->subcategory_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->aSubcategories->addItemss($this); */ } return $this->aSubcategories; }
/** * Returns the number of related Subcategories objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con * @return int Count of related Subcategories objects. * @throws PropelException */ public function countSubcategoriess(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collSubcategoriessPartial && !$this->isNew(); if (null === $this->collSubcategoriess || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collSubcategoriess) { return 0; } if ($partial && !$criteria) { return count($this->getSubcategoriess()); } $query = ChildSubcategoriesQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query->filterByCategories($this)->count($con); } return count($this->collSubcategoriess); }
/** * Returns a new ChildSubcategoriesQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return ChildSubcategoriesQuery */ public static function create($modelAlias = null, Criteria $criteria = null) { if ($criteria instanceof ChildSubcategoriesQuery) { return $criteria; } $query = new ChildSubcategoriesQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }