/** * 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(ProductionHistoryPeer::PRODUCTION_HISTORY_ID, $pks, Criteria::IN); $objs = ProductionHistoryPeer::doSelect($criteria, $con); } return $objs; }
/** * 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->aUser !== null) { if (!$this->aUser->validate($columns)) { $failureMap = array_merge($failureMap, $this->aUser->getValidationFailures()); } } if ($this->aProduction !== null) { if (!$this->aProduction->validate($columns)) { $failureMap = array_merge($failureMap, $this->aProduction->getValidationFailures()); } } if (($retval = ProductionHistoryPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } $this->alreadyInValidation = false; } return !empty($failureMap) ? $failureMap : true; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Production is new, it will return * an empty collection; or if this Production has previously * been saved, it will retrieve related ProductionHistorys 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 Production. */ public function getProductionHistorysJoinUser($criteria = null, $con = null) { // include the Peer class include_once 'src/model/whiteboard/om/BaseProductionHistoryPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collProductionHistorys === null) { if ($this->isNew()) { $this->collProductionHistorys = array(); } else { $criteria->add(ProductionHistoryPeer::PRODUCTION_ID, $this->getProductionId()); $this->collProductionHistorys = ProductionHistoryPeer::doSelectJoinUser($criteria, $con); } } else { // 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(ProductionHistoryPeer::PRODUCTION_ID, $this->getProductionId()); if (!isset($this->lastProductionHistoryCriteria) || !$this->lastProductionHistoryCriteria->equals($criteria)) { $this->collProductionHistorys = ProductionHistoryPeer::doSelectJoinUser($criteria, $con); } } $this->lastProductionHistoryCriteria = $criteria; return $this->collProductionHistorys; }