예제 #1
0
 /**
  * Gets an array of AuthorArticle objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Article has previously been saved, it will retrieve
  * related AuthorArticles from storage. If this Article is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array AuthorArticle[]
  * @throws     PropelException
  */
 public function getAuthorArticles($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(ArticlePeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collAuthorArticles === null) {
         if ($this->isNew()) {
             $this->collAuthorArticles = array();
         } else {
             $criteria->add(AuthorArticlePeer::ARTICLE_ID, $this->id);
             AuthorArticlePeer::addSelectColumns($criteria);
             $this->collAuthorArticles = AuthorArticlePeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // 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(AuthorArticlePeer::ARTICLE_ID, $this->id);
             AuthorArticlePeer::addSelectColumns($criteria);
             if (!isset($this->lastAuthorArticleCriteria) || !$this->lastAuthorArticleCriteria->equals($criteria)) {
                 $this->collAuthorArticles = AuthorArticlePeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastAuthorArticleCriteria = $criteria;
     return $this->collAuthorArticles;
 }
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $author_id
  * @param      int $article_id
  * @param      PropelPDO $con
  * @return     AuthorArticle
  */
 public static function retrieveByPK($author_id, $article_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $author_id, (string) $article_id));
     if (null !== ($obj = AuthorArticlePeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(AuthorArticlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(AuthorArticlePeer::DATABASE_NAME);
     $criteria->add(AuthorArticlePeer::AUTHOR_ID, $author_id);
     $criteria->add(AuthorArticlePeer::ARTICLE_ID, $article_id);
     $v = AuthorArticlePeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
예제 #3
0
 public function getAuthorArticles($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(AuthorPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collAuthorArticles === null) {
         if ($this->isNew()) {
             $this->collAuthorArticles = array();
         } else {
             $criteria->add(AuthorArticlePeer::AUTHOR_ID, $this->id);
             AuthorArticlePeer::addSelectColumns($criteria);
             $this->collAuthorArticles = AuthorArticlePeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(AuthorArticlePeer::AUTHOR_ID, $this->id);
             AuthorArticlePeer::addSelectColumns($criteria);
             if (!isset($this->lastAuthorArticleCriteria) || !$this->lastAuthorArticleCriteria->equals($criteria)) {
                 $this->collAuthorArticles = AuthorArticlePeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastAuthorArticleCriteria = $criteria;
     return $this->collAuthorArticles;
 }
 public function getAuthorArticles($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseAuthorArticlePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collAuthorArticles === null) {
         if ($this->isNew()) {
             $this->collAuthorArticles = array();
         } else {
             $criteria->add(AuthorArticlePeer::ARTICLE_ID, $this->getId());
             AuthorArticlePeer::addSelectColumns($criteria);
             $this->collAuthorArticles = AuthorArticlePeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(AuthorArticlePeer::ARTICLE_ID, $this->getId());
             AuthorArticlePeer::addSelectColumns($criteria);
             if (!isset($this->lastAuthorArticleCriteria) || !$this->lastAuthorArticleCriteria->equals($criteria)) {
                 $this->collAuthorArticles = AuthorArticlePeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastAuthorArticleCriteria = $criteria;
     return $this->collAuthorArticles;
 }
예제 #5
0
 public static function retrieveByPK($author_id, $article_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(AuthorArticlePeer::AUTHOR_ID, $author_id);
     $criteria->add(AuthorArticlePeer::ARTICLE_ID, $article_id);
     $v = AuthorArticlePeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
 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(AuthorArticlePeer::ID, $pks, Criteria::IN);
         $objs = AuthorArticlePeer::doSelect($criteria, $con);
     }
     return $objs;
 }