public function testReadAccessorsReturnPropertiesValues() { $parameters = new ParameterBag(['foo' => 'bar']); $objects = new ObjectBag(['dummy' => $std = new \stdClass()]); $set = new ObjectSet($parameters, $objects); $this->assertSame(['foo' => 'bar'], $set->getParameters()); $this->assertEquals(['dummy' => $std], $set->getObjects()); $this->assertCount(1, $set->getObjects()); }
/** * Constructor * * @param ObjectConfig $config An optional ObjectConfig object with configuration options * @return DatabaseRowsetAbstract */ public function __construct(ObjectConfig $config) { //Bypass DatabaseRowsetAbstract constructor to prevent data from being added twice ObjectSet::__construct($config); //Set the row cloning $this->_row_cloning = $config->row_cloning; //Set the table identifier $this->_table = $config->table; // Set the table identifier if (isset($config->identity_column)) { $this->_identity_column = $config->identity_column; } // Reset the rowset $this->reset(); // Insert the data, if exists if (!empty($config->data)) { $this->addRow($config->data->toArray(), $config->status); } //Set the status message if (!empty($config->status_message)) { $this->setStatusMessage($config->status_message); } }
/** * Defined by IteratorAggregate * * @return \ArrayIterator */ public function getIterator() { return $this->__rowset->getIterator(); }
/** * {@inheritdoc} */ public function __construct() { parent::__construct(); $this->isCompletelyLoaded = true; }
function __construct($rs, $object) { parent::__construct($rs, $object); }
/** * Search the mixin method map and call the method or forward the call to each row for processing. * * @param string $method The function name * @param array $arguments The function arguments * @throws \BadMethodCallException If method could not be found * @return mixed The result of the function */ public function __call($method, $arguments) { //If the mixed method exists call it for all the rows if (!isset($this->_mixed_methods[$method])) { foreach ($this as $i => $row) { $row->__call($method, $arguments); } return $this; } return parent::__call($method, $arguments); }
/** * Defined by IteratorAggregate * * @return \ArrayIterator */ public function getIterator() { return $this->__entities->getIterator(); }