コード例 #1
0
 /**
  * Find available for article
  *
  * @param  Newscoop\Package\Article $article
  * @return array
  */
 public function findAvailableForArticle(Article $article)
 {
     $queryBuilder = $this->createQueryBuilder('p');
     $attachedIds = array_map(function ($package) {
         return $package->getId();
     }, $article->getPackages()->toArray());
     if (!empty($attachedIds)) {
         $queryBuilder->where($queryBuilder->expr()->notIn('p.id', implode(', ', $attachedIds)));
     }
     $queryBuilder->orderBy('p.id', 'desc');
     return $queryBuilder->getQuery()->getResult();
 }
コード例 #2
0
 public function getPackages()
 {
     $this->__load();
     return parent::getPackages();
 }