/**
  * 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 Onlines 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 getOnlinesJoinUser($criteria = null, $con = null)
 {
     // include the Peer class
     include_once 'src/model/whiteboard/om/BaseOnlinePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collOnlines === null) {
         if ($this->isNew()) {
             $this->collOnlines = array();
         } else {
             $criteria->add(OnlinePeer::PRODUCTION_ID, $this->getProductionId());
             $this->collOnlines = OnlinePeer::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(OnlinePeer::PRODUCTION_ID, $this->getProductionId());
         if (!isset($this->lastOnlineCriteria) || !$this->lastOnlineCriteria->equals($criteria)) {
             $this->collOnlines = OnlinePeer::doSelectJoinUser($criteria, $con);
         }
     }
     $this->lastOnlineCriteria = $criteria;
     return $this->collOnlines;
 }
 /**
  * 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 = OnlinePeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
 /**
 * Retrieve object using using composite pkey values.
 * @param int $user_id
   @param int $production_id
   
 * @param      Connection $con
 * @return     Online
 */
 public static function retrieveByPK($user_id, $production_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(OnlinePeer::USER_ID, $user_id);
     $criteria->add(OnlinePeer::PRODUCTION_ID, $production_id);
     $v = OnlinePeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }