/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Book is new, it will return * an empty collection; or if this Book has previously * been saved, it will retrieve related Items from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Book. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array Item[] List of Item objects */ public function getItemsJoinItemRelatedByPackageId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = ItemQuery::create(null, $criteria); $query->joinWith('ItemRelatedByPackageId', $join_behavior); return $this->getItems($query, $con); }
public static function getComponents(array $itemIds) { $query = ItemQuery::create()->filterByPackageId($itemIds)->orderBy('Item.Title')->find(); return $query; }
/** * Get the associated Item object * * @param PropelPDO Optional Connection object. * @return Item The associated Item object. * @throws PropelException */ public function getItem(PropelPDO $con = null) { if ($this->aItem === null && $this->item_id !== null) { $this->aItem = ItemQuery::create()->findPk($this->item_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->aItem->addSectionHasItems($this); */ } return $this->aItem; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Item is new, it will return * an empty collection; or if this Item has previously * been saved, it will retrieve related ItemsRelatedById from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Item. * * @param Criteria $criteria optional Criteria object to narrow the query * @param PropelPDO $con optional connection object * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) * @return PropelCollection|array Item[] List of Item objects */ public function getItemsRelatedByIdJoinBook($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $query = ItemQuery::create(null, $criteria); $query->joinWith('Book', $join_behavior); return $this->getItemsRelatedById($query, $con); }
/** * Gets the number of Item objects related by a many-to-many relationship * to the current object by way of the section_has_item cross-reference table. * * @param Criteria $criteria Optional query object to filter the query * @param boolean $distinct Set to true to force count distinct * @param PropelPDO $con Optional connection object * * @return int the number of related Item objects */ public function countItems($criteria = null, $distinct = false, PropelPDO $con = null) { if (null === $this->collItems || null !== $criteria) { if ($this->isNew() && null === $this->collItems) { return 0; } else { $query = ItemQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query->filterBySection($this)->count($con); } } else { return count($this->collItems); } }