/** * Description : List the productions's room * * @param String roomId : Room id * @return : Collection of permission */ public function listProductionsByRoom($roomId) { try { $criteria = new Criteria(); $criteria->add(ProductionPeer::ROOM_ID, $roomId); return ProductionPeer::doSelect($criteria); } catch (Exception $e) { return array(); } }
/** * Get the associated Production object * * @param Connection Optional Connection object. * @return Production The associated Production object. * @throws PropelException */ public function getProduction($con = null) { // include the related Peer class include_once 'src/model/whiteboard/om/BaseProductionPeer.php'; if ($this->aProduction === null && $this->production_id !== null) { $this->aProduction = ProductionPeer::retrieveByPK($this->production_id, $con); /* The following can be used instead of the line above to guarantee the related object contains a reference to this object, but this level of coupling may be undesirable in many circumstances. As it can lead to a db query with many results that may never be used. $obj = ProductionPeer::retrieveByPK($this->production_id, $con); $obj->addProductions($this); */ } return $this->aProduction; }
/** * Returns the number of related Productions. * * @param Criteria $criteria * @param boolean $distinct * @param Connection $con * @throws PropelException */ public function countProductions($criteria = null, $distinct = false, $con = null) { // include the Peer class include_once 'src/model/whiteboard/om/BaseProductionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(ProductionPeer::ROOM_ID, $this->getRoomId()); return ProductionPeer::doCount($criteria, $distinct, $con); }
/** * Selects a collection of Element objects pre-filled with all related objects. * * @return array Array of Element objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAll(Criteria $c, $con = null) { $c = clone $c; // Set the correct dbName if it has not been overridden if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } ElementPeer::addSelectColumns($c); $startcol2 = ElementPeer::NUM_COLUMNS - ElementPeer::NUM_LAZY_LOAD_COLUMNS + 1; ProductionPeer::addSelectColumns($c); $startcol3 = $startcol2 + ProductionPeer::NUM_COLUMNS; $c->addJoin(ElementPeer::PRODUCTION_ID, ProductionPeer::PRODUCTION_ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = ElementPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); // Add objects for joined Production rows $omClass = ProductionPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getProduction(); // CHECKME if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addElement($obj1); // CHECKME break; } } if ($newObject) { $obj2->initElements(); $obj2->addElement($obj1); } $results[] = $obj1; } return $results; }
/** * Selects a collection of Message objects pre-filled with all related objects except User. * * @return array Array of Message objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptUser(Criteria $c, $con = null) { $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } MessagePeer::addSelectColumns($c); $startcol2 = MessagePeer::NUM_COLUMNS - MessagePeer::NUM_LAZY_LOAD_COLUMNS + 1; ProductionPeer::addSelectColumns($c); $startcol3 = $startcol2 + ProductionPeer::NUM_COLUMNS; $c->addJoin(MessagePeer::PRODUCTION_ID, ProductionPeer::PRODUCTION_ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = MessagePeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = ProductionPeer::getOMClass(); $cls = Propel::import($omClass); $obj2 = new $cls(); $obj2->hydrate($rs, $startcol2); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj2 = $temp_obj1->getProduction(); //CHECKME if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addMessage($obj1); break; } } if ($newObject) { $obj2->initMessages(); $obj2->addMessage($obj1); } $results[] = $obj1; } return $results; }
/** * This function performs the validation work for complex object models. * * In addition to checking the current object, all related objects will * also be validated. If all pass then <code>true</code> is returned; otherwise * an aggreagated array of ValidationFailed objects will be returned. * * @param array $columns Array of column names to validate. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. */ protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { $this->alreadyInValidation = true; $retval = null; $failureMap = array(); // We call the validate method on the following object(s) if they // were passed to this object by their coresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aRoom !== null) { if (!$this->aRoom->validate($columns)) { $failureMap = array_merge($failureMap, $this->aRoom->getValidationFailures()); } } if (($retval = ProductionPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } if ($this->collElements !== null) { foreach ($this->collElements as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } if ($this->collMessages !== null) { foreach ($this->collMessages as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } if ($this->collHistorys !== null) { foreach ($this->collHistorys as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } if ($this->collProductionHistorys !== null) { foreach ($this->collProductionHistorys as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } if ($this->collOnlines !== null) { foreach ($this->collOnlines as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } $this->alreadyInValidation = false; } return !empty($failureMap) ? $failureMap : true; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(ProductionPeer::PRODUCTION_ID, $pks, Criteria::IN); $objs = ProductionPeer::doSelect($criteria, $con); } return $objs; }