setDataFromCollection() public method

Populates the internal $this->data collection of a relation from the contents of the provided collection. This is used by DataModel to push the eager loaded data into each item's relation.
public setDataFromCollection ( string $name, Collection &$data, mixed $keyMap = null ) : void
$name string Relation name
$data Collection The relation data to push into this relation
$keyMap mixed Used by many-to-many relations to pass around the local to foreign key map
return void
Esempio n. 1
0
 /**
  * @group       RelationManager
  * @group       RelationManagerSetDataFromCollection
  * @covers      FOF30\Model\DataModel\RelationManager::setDataFromCollection
  */
 public function testSetDataFromCollectionException()
 {
     $this->setExpectedException('FOF30\\Model\\DataModel\\Relation\\Exception\\RelationNotFound');
     $collection = new Collection();
     $model = $this->buildModel();
     $relation = new RelationManager($model);
     $relation->setDataFromCollection('test', $collection);
 }