Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $artistQuery = new ArtistQuery($this->getContainer()->get('doctrine_mongodb')->getManager());
     $artists = $artistQuery->getList();
     foreach ($artists as $artist) {
         if (count($artist->getAlbums()) == 0) {
             $artist->setDisabled();
             $artistQuery->persist($artist);
         }
     }
 }
Пример #2
0
 /**
  * @param $limit
  * @param $offset
  * @param $genre
  * @return mixed
  */
 private function getArtistList($limit, $offset, $genre = null)
 {
     $dm = $this->get('doctrine_mongodb')->getManager();
     $artistQuery = new ArtistQuery($dm);
     $artistQuery->addOrderBy('name')->isProcessed()->isNotDisabled()->setLimit($limit, $offset);
     if (!is_null($genre)) {
         $artistQuery->addTag($genre);
     }
     $artists = $artistQuery->getList();
     return $artists;
 }