setDataFromCollection() публичный Метод

Populates the internal $this->data collection 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 ( Collection &$data, mixed $keyMap = null ) : void
$data FOF30\Model\DataModel\Collection The relation data to push into this relation
$keyMap mixed Passes around the local to foreign key map
Результат void
Пример #1
0
 /**
  * @group           BelongsToMany
  * @group           BelongsToManySetDataFromCollection
  * @covers          FOF30\Model\DataModel\Relation\BelongsToMany::setDataFromCollection
  * @dataProvider    BelongsToManyDataprovider::getTestSetDataFromCollection
  */
 public function testSetDataFromCollection($test, $check)
 {
     $msg = 'BelongsToMany::setDataFromCollection %s - Case: ' . $check['case'];
     $parts = new Parts(static::$container);
     $model = new Groups(static::$container);
     $model->find(2);
     $relation = new BelongsToMany($model, 'Parts');
     $items[0] = clone $parts;
     $items[0]->find(1);
     $items[1] = clone $parts;
     $items[1]->find(2);
     $items[2] = clone $parts;
     $items[2]->find(3);
     $data = new Collection($items);
     $relation->setDataFromCollection($data, $test['keymap']);
     $this->assertCount($check['count'], ReflectionHelper::getValue($relation, 'data'), sprintf($msg, ''));
 }