Convert models to entity objects.

@return \ProAI\Datamapper\Support\Collection
324434
public function toDatamapperObject()
    {
        $entities = new DatamapperCollection;

        foreach ($this->items as $name => $item) {
            $entities->put($name, $item->toDatamapperObject());
        }

        return $entities;
    }
980201
protected function getModels()
    {
        if ($this->_models === null) {
            $this->_models = [];
            $timings = $this->calculateTimings();

            foreach ($timings as $seq => $dbTiming) {
                $this->_models[] = [
                    'method' => $this->getRequestMethod($dbTiming['info']),
                    'type' => $this->getRequestType($dbTiming['category']),
                    'request' => $dbTiming['info'],
                    'duration' => ($dbTiming['duration'] * 1000), // in milliseconds
                    'trace' => $dbTiming['trace'],
                    'timestamp' => ($dbTiming['timestamp'] * 1000), // in milliseconds
                    'seq' => $seq,
                ];
            }
        }

        return $this->_models;
    }
447847
public function toArray()
    {
        $result = array();
        foreach ($this as $key => $entity) {
            $result[$key] = $entity->toArray();
        }
        return $result;
    }
228714
public static function getModels() {
        return self::cache(__METHOD__, function() {
            $plugins = array_merge(array(Configure::read('Admin.coreName')), App::objects('plugins'));
            $map = array();

            foreach ($plugins as $plugin) {
                $data = Admin::getPlugin($plugin);

                if ($data['models']) {
                    $map[$plugin] = $data;
                }
            }

            ksort($map);

            return $map;
        });
    }
1086143
protected function getEntities() {
        if (!$this->_entities) {
            $this->_entities = new EntityList($this->version, $this->solution['sid']);
        }

        return $this->_entities;
    }
43428
public function toArray()
    {
        $result = array();
        if($entity = $this->getIterator()->current()) {
            $result = $entity->toArray();
        }

        return $result;
    }
694090
protected function nestedDataObjectClasses()
    {
        $types = [];
        $instance = $this->getDataObjectInstance();
        $fields = $this->fields->column('Name');

        foreach ($fields as $fieldName) {
            $result = $instance->obj($fieldName);
            if ($result instanceof DataObjectInterface) {
                $types[$fieldName] = get_class($result);
            }
        }

        return $types;
    }
468452
protected function loadEntity()
    {
        $params = array_merge($this->params()->fromPost(), $this->params()->fromRoute());
        if (empty($params['id'])) {
            throw new EntityNotFoundException('Bad Request');
        }

        $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');

        if (!$model = $objectManager->getRepository(get_class($this->getEntity()))->find($params['id'])) {
            throw new EntityNotFoundException('Entity not found');
        }
        return $model;
    }
473660
public function getList()
    {
        $result = $this->execute();
        $list = new ArrayCollection;

        //Convert all of them to entities
        foreach ($result as $row)
        {
            $list->add($this->convertValue($row[0]));
        }

        return $list;
    }
1360544
@Override
	public CollectionModel<D> toCollectionModel(Iterable<? extends T> entities) {
		return this.map(entities).toResources();
	}
1236856
public function retriveLayerObjects()
    {
        $classes = [];
        foreach ($this->engine->query('//dia:diagram/dia:layer') as $layer) {
            if ($layer->nodeName == 'dia:layer') {
                foreach ($layer->childNodes as $elementObject) {
                    if ($elementObject->nodeName == 'dia:object') {
                        foreach ($elementObject->childNodes as $childNodesAttributes) {
                            if ($childNodesAttributes->nodeName == 'dia:attribute' &&
                                    $childNodesAttributes->attributes->getNamedItem("name")->nodeValue == 'name'
                            ) {
                                $name = str_replace(['#'], [''], $childNodesAttributes->childNodes->item(1)->nodeValue);

                                $classes[$name] = $elementObject;
                            }
                        }
                    }
                }
            }
        }

        return $classes;
    }
954237
public function toObjectArray() : array
    {
        if ($this->isEmpty()) {
            return [];
        }

        $skeleton = $this->_model;

        return array_map(function ($entry) use ($skeleton) {
            return Model::cloneResult($skeleton, $entry);
        }, $this->toArray());
    }
70364
public function getDataModel()
    {
        $dataModel = array();
        $model     = $this->config->getDataModel();

        foreach ($this->getEditFieldsArrays() as $name => $options) {
            //if this is a key, set it to 0
            if ($options['type'] === 'key') {
                $dataModel[$name] = 0;
            } else {
                //if this is a collection, convert it to an array
                if (is_a($model->$name, 'Illuminate\Database\Eloquent\Collection')) {
                    $dataModel[$name] = $model->$name->toArray();
                } else {
                    $dataModel[$name] = isset($options['value']) ? $options['value'] : null;
                }
            }
        }

        return $dataModel;
    }
588953
protected function _initObjects()
    {
        $this->_configDataObject = $this->_configFactory->create(
            [
                'data' => [
                    'section'   => $this->getSectionCode(),
                    'container' => $this->getContainerCode(),
                    'store'     => $this->getStoreCode(),
                ],
            ]
        );

        $this->_configData       = $this->_configDataObject->load();
        $this->_fieldsetRenderer = $this->_fieldsetFactory->create();
        $this->_fieldRenderer    = $this->_fieldFactory->create();

        return $this;
    }
1006073
public function getModels ($entities)
    {
        $models = array();

        foreach ($entities as $entity) {
            $models[] = $this->getModel($entity);
        }

        return $models;
    }
203825
public function toArray()
    {
        $data = parent::toArray();

        foreach ($this->getComputedProperties() as $property)
        {
            if ($this->{$property} instanceof ModelEntityInterface) {
                $data[$property] = array_values($this->{$property}->toArray());
            } else {
                $data[$property] = $this->{$property};
            }
        }

        foreach(array_keys($data) as $key)
        {
            if (substr($key, 0, 1) === '_') {
                unset($data[$key]);
            }
        }

        return $data;
    }
468580
public function getDataMapper()
    {
        $dataMapper = Ioc::make(DataMapper::class);
        $dataMapper->setSchema($this->getSchema());

        return $dataMapper;
    }