/** * Constructor. * * @param array|object $data * @param PropertyAccessorInterface $accessor * @param array $mapping * @param string|null $idPath * * @throws DataException */ public function __construct($data, PropertyAccessorInterface $accessor, array $mapping = array(), $idPath = null) { if (!is_array($data) && !is_object($data)) { throw DataException::invalidEntityData($data); } $this->data = $data; $this->accessor = $accessor; $this->mapping = $mapping; $this->idPath = $idPath; }
/** * Returns original data. * * @return array|\Traversable * * @throws DataException */ public function getRaw() { switch ($this->type) { case self::TYPE_ARRAY: return $this->data->getArrayCopy(); case self::TYPE_ITERATOR: return $this->data; case self::TYPE_AGGREGATE: return $this->data->getInnerIterator(); } throw DataException::invalidCollectionData($this->data); }