/** * Gets an array of Element objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Category has previously been saved, it will retrieve * related Elements from storage. If this Category is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Element[] * @throws PropelException */ public function getElements($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(CategoryPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collElements === null) { if ($this->isNew()) { $this->collElements = array(); } else { $criteria->add(ElementPeer::CATEGORY_ID, $this->id); ElementPeer::addSelectColumns($criteria); $this->collElements = ElementPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(ElementPeer::CATEGORY_ID, $this->id); ElementPeer::addSelectColumns($criteria); if (!isset($this->lastElementCriteria) || !$this->lastElementCriteria->equals($criteria)) { $this->collElements = ElementPeer::doSelect($criteria, $con); } } } $this->lastElementCriteria = $criteria; return $this->collElements; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(ElementPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(ElementPeer::DATABASE_NAME); $criteria->add(ElementPeer::ID, $pks, Criteria::IN); $objs = ElementPeer::doSelect($criteria, $con); } return $objs; }
/** * Description : Retrieves the elements of a production * * @param String $idProduction : The id of a production * @return : Returns a collection of elements */ public function retrieveProduction($idProduction) { try { $criteria = new Criteria(); $criteria->add(ElementPeer::PRODUCTION_ID, $idProduction); return ElementPeer::doSelect($criteria); } catch (Exception $e) { return null; } }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Production has previously * been saved, it will retrieve related Elements from storage. * If this Production is new, it will return * an empty collection or the current collection, the criteria * is ignored on a new object. * * @param Connection $con * @param Criteria $criteria * @throws PropelException */ public function getElements($criteria = null, $con = null) { // include the Peer class include_once 'src/model/whiteboard/om/BaseElementPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collElements === null) { if ($this->isNew()) { $this->collElements = array(); } else { $criteria->add(ElementPeer::PRODUCTION_ID, $this->getProductionId()); ElementPeer::addSelectColumns($criteria); $this->collElements = ElementPeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(ElementPeer::PRODUCTION_ID, $this->getProductionId()); ElementPeer::addSelectColumns($criteria); if (!isset($this->lastElementCriteria) || !$this->lastElementCriteria->equals($criteria)) { $this->collElements = ElementPeer::doSelect($criteria, $con); } } } $this->lastElementCriteria = $criteria; return $this->collElements; }