コード例 #1
0
ファイル: Object.php プロジェクト: MarcelMC/Avenue
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @throws LogicException if no primary key is defined
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = ChildObjectQuery::create();
     $criteria->add(ObjectTableMap::COL_ID, $this->id);
     return $criteria;
 }
コード例 #2
0
ファイル: ObjectServices.php プロジェクト: MarcelMC/Avenue
 /**
  * Get the associated ChildObject object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildObject The associated ChildObject object.
  * @throws PropelException
  */
 public function getObject(ConnectionInterface $con = null)
 {
     if ($this->aObject === null && $this->id_object !== null) {
         $this->aObject = ChildObjectQuery::create()->findPk($this->id_object, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aObject->addObjectServicess($this);
            */
     }
     return $this->aObject;
 }
コード例 #3
0
ファイル: Category.php プロジェクト: MarcelMC/Avenue
 /**
  * Gets the number of Object objects related by a many-to-many relationship
  * to the current object by way of the object_category cross-reference table.
  *
  * @param      Criteria $criteria Optional query object to filter the query
  * @param      boolean $distinct Set to true to force count distinct
  * @param      ConnectionInterface $con Optional connection object
  *
  * @return int the number of related Object objects
  */
 public function countObjects(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collObjectsPartial && !$this->isNew();
     if (null === $this->collObjects || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collObjects) {
             return 0;
         } else {
             if ($partial && !$criteria) {
                 return count($this->getObjects());
             }
             $query = ChildObjectQuery::create(null, $criteria);
             if ($distinct) {
                 $query->distinct();
             }
             return $query->filterByCategory($this)->count($con);
         }
     } else {
         return count($this->collObjects);
     }
 }
コード例 #4
0
ファイル: ObjectQuery.php プロジェクト: MarcelMC/Avenue
 /**
  * Returns a new ChildObjectQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildObjectQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildObjectQuery) {
         return $criteria;
     }
     $query = new ChildObjectQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }