예제 #1
0
파일: User.php 프로젝트: nirkbirk/site
 /**
  * Returns the number of related News objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      ConnectionInterface $con
  * @return int             Count of related News objects.
  * @throws PropelException
  */
 public function countNews(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collNewsPartial && !$this->isNew();
     if (null === $this->collNews || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collNews) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getNews());
         }
         $query = ChildNewsQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterByUser($this)->count($con);
     }
     return count($this->collNews);
 }
예제 #2
0
파일: NewsQuery.php 프로젝트: nirkbirk/site
 /**
  * Returns a new ChildNewsQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildNewsQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildNewsQuery) {
         return $criteria;
     }
     $query = new ChildNewsQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
예제 #3
0
파일: News.php 프로젝트: nirkbirk/site
 /**
  * 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 = ChildNewsQuery::create();
     $criteria->add(NewsTableMap::COL_ID, $this->id);
     return $criteria;
 }