Ejemplo n.º 1
1
 /**
  * @param Query           $query
  * @param OutputInterface $output
  * @param array           $fields
  */
 protected function displayFeeds(Query $query, OutputInterface $output, array $fields)
 {
     $table = new Table($output);
     $table->setHeaders($fields);
     /** @var ClassMetadata $meta */
     $meta = $this->doctrine->getManager()->getClassMetadata('TreeHouseIoBundle:Feed');
     /** @var Feed $feed */
     foreach ($query->iterate() as list($feed)) {
         $row = [];
         foreach ($fields as $field) {
             $value = $meta->getFieldValue($feed, $field);
             $row[$field] = $this->formatValue($value);
         }
         $table->addRow($row);
     }
     $table->render();
 }
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if (!$this->iterableResult) {
         $this->iterableResult = $this->query->iterate(array(), Query::HYDRATE_ARRAY);
     }
     $this->iterableResult->rewind();
 }
 /**
  * {@inheritdoc}
  */
 public function rewind()
 {
     if ($this->iterator) {
         throw new InvalidMethodCallException('Cannot rewind a Doctrine\\ORM\\Query');
     }
     $this->iterator = $this->query->iterate();
     $this->iterator->rewind();
 }