/**
  * {@inheritdoc}
  */
 protected function projectDataProvider()
 {
     $propertyProyector = new PropertyProjector();
     $propertyProyector->add(new Property(Selectors::key('bar'), 'fooBar'));
     /** @var \Cubiche\Core\Projection\ForEachProjector $projector */
     $projector = $this->newTestedInstance(Selectors::key('foo'), $propertyProyector);
     $result1 = new DefaultProjectionBuilder();
     $result1->set('fooBar', 1);
     $result2 = new DefaultProjectionBuilder();
     $result2->set('fooBar', 2);
     return array(array($projector, array('foo' => array(array('bar' => 1), array('bar' => 2))), new \ArrayIterator(array($result1, $result2))));
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 protected function projectDataProvider()
 {
     $propertyProyector1 = new PropertyProjector();
     $propertyProyector1->add(new Property(Selectors::key('foo'), 'foo'));
     $propertyProyector2 = new PropertyProjector();
     $propertyProyector2->add(new Property(Selectors::key('bar'), 'bar'));
     /** @var \Cubiche\Core\Projection\JoinProjector $projector */
     $projector = $this->newTestedInstance($propertyProyector1, $propertyProyector2);
     $result = new DefaultProjectionBuilder();
     $result->set('foo', 1);
     $result->set('bar', 2);
     return array(array($projector, array('foo' => 1, 'bar' => 2), new \ArrayIterator(array($result))));
 }
 /**
  * @param string $name
  *
  * @throws \LogicException
  */
 private function addProperty($name = null)
 {
     if ($name === null) {
         $name = $this->currentSelector instanceof NamedSelectorInterface ? $this->currentSelector->name() : 'field' . $this->nonameCount++;
     }
     $this->projector->add(new Property($this->currentSelector, $name));
     $this->currentSelector = null;
 }