Пример #1
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aPrincipal instanceof Persistent) {
             $this->aPrincipal->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aPrincipal = null;
 }
Пример #2
0
 /**
  * @param	Principal $principal The principal object to add.
  */
 protected function doAddPrincipal($principal)
 {
     $this->collPrincipals[] = $principal;
     $principal->setState($this);
 }
Пример #3
0
 /**
  * Filter the query by a related Principal object
  *
  * @param   Principal|PropelObjectCollection $principal The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 PrincipalI18nQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPrincipal($principal, $comparison = null)
 {
     if ($principal instanceof Principal) {
         return $this->addUsingAlias(PrincipalI18nPeer::ID, $principal->getId(), $comparison);
     } elseif ($principal instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PrincipalI18nPeer::ID, $principal->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByPrincipal() only accepts arguments of type Principal or PropelCollection');
     }
 }
Пример #4
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aState instanceof Persistent) {
             $this->aState->clearAllReferences($deep);
         }
         if ($this->aCountry instanceof Persistent) {
             $this->aCountry->clearAllReferences($deep);
         }
         if ($this->aPrincipal instanceof Persistent) {
             $this->aPrincipal->clearAllReferences($deep);
         }
         if ($this->aUser instanceof Persistent) {
             $this->aUser->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aState = null;
     $this->aCountry = null;
     $this->aPrincipal = null;
     $this->aUser = null;
 }
Пример #5
0
 /**
  * Exclude object from result
  *
  * @param   Principal $principal Object to remove from the list of results
  *
  * @return PrincipalQuery The current query, for fluid interface
  */
 public function prune($principal = null)
 {
     if ($principal) {
         $this->addUsingAlias(PrincipalPeer::ID, $principal->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Пример #6
0
 /**
  * Filter the query by a related Principal object
  *
  * @param   Principal|PropelObjectCollection $principal  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 StateQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPrincipal($principal, $comparison = null)
 {
     if ($principal instanceof Principal) {
         return $this->addUsingAlias(StatePeer::ID, $principal->getStateId(), $comparison);
     } elseif ($principal instanceof PropelObjectCollection) {
         return $this->usePrincipalQuery()->filterByPrimaryKeys($principal->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByPrincipal() only accepts arguments of type Principal or PropelCollection');
     }
 }
Пример #7
0
 /**
  * Exchange the rank of the object with the one passed as argument, and saves both objects
  *
  * @param     Principal $object
  * @param     PropelPDO $con optional connection
  *
  * @return    Principal the current object
  *
  * @throws Exception if the database cannot execute the two updates
  */
 public function swapWith($object, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(PrincipalPeer::DATABASE_NAME);
     }
     $con->beginTransaction();
     try {
         $oldRank = $this->getSortableRank();
         $newRank = $object->getSortableRank();
         $this->setSortableRank($newRank);
         $this->save($con);
         $object->setSortableRank($oldRank);
         $object->save($con);
         $con->commit();
         return $this;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Пример #8
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param Principal $obj A Principal object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         PrincipalPeer::$instances[$key] = $obj;
     }
 }
Пример #9
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->collProductAssignments) {
             foreach ($this->collProductAssignments as $o) {
                 $o->clearAllReferences($deep);
             }
         }
         if ($this->collProductSurveys) {
             foreach ($this->collProductSurveys as $o) {
                 $o->clearAllReferences($deep);
             }
         }
         if ($this->collTransactions) {
             foreach ($this->collTransactions as $o) {
                 $o->clearAllReferences($deep);
             }
         }
         if ($this->aPrincipal instanceof Persistent) {
             $this->aPrincipal->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     if ($this->collProductAssignments instanceof PropelCollection) {
         $this->collProductAssignments->clearIterator();
     }
     $this->collProductAssignments = null;
     if ($this->collProductSurveys instanceof PropelCollection) {
         $this->collProductSurveys->clearIterator();
     }
     $this->collProductSurveys = null;
     if ($this->collTransactions instanceof PropelCollection) {
         $this->collTransactions->clearIterator();
     }
     $this->collTransactions = null;
     $this->aPrincipal = null;
 }