Encapsulates the entities list in their appropriate classes and returns as part of a collection

@param   array  $entities  The filesystem contents
@return  \Hubzero\Filesystem\Collection
337551
private function encapsulate($entities)
	{
		$items = [];

		foreach ($entities as $entity)
		{
			$items[] = Entity::fromMetadata($entity, $this);
		}

		return new Collection($items);
	}
347348
protected function getFiles(array $files)
    {
        $filesEntity = [];

        foreach ($files as $file) {
            $filesEntity[] = new File($file);
        }

        return $filesEntity;
    }
245801
public function getRepository($entityName)
    {
        return new ListRepository($this->em, $this->em->getClassMetadata($entityName), $this);
    }
1355488
protected function buildLazyCollection($items)
    {
        if ($this->em === null) {
            return parent::getIterator();
        }
        $collection = new LazyCollection();

        foreach ($items as $proxy) {
            $collection->add(new EntityProxy($proxy->to_contenttype, $proxy->to_id, $this->em));
        }

        return $collection;
    }
255919
public function repository($entity)
    {
        if (!is_string($entity)) {
            $entity = get_class($entity);
        }

        // First we check if the repository is not already created.
        if (array_key_exists($entity, $this->repositories)) {
            return $this->repositories[$entity];
        }

        $this->repositories[$entity] = new Repository($this->mapper($entity));

        return $this->repositories[$entity];
    }
1008757
public function getApiObjects($entities, $locale)
    {
        return array_map(
            function($entity) use ($locale) {
                return $this->getApiObject($entity, $locale);
            },
            $entities
        );
    }
722791
public function getData(Entity $entity)
    {
        $column = $this->analyzer->listColumns();
        $data = array();

        foreach ($column as $key => $value) {
            $method = 'get' . Utils::capitalize($key);
            $data[$key] = $entity->$method();
            if (is_null($data[$key])) $data[$key] = array();
            if ($data[$key] instanceof ArrayCollection) $data[$key] = $data[$key]->toArray();
        }

        $data['objectclass'] = $entity->getObjectClass()->toArray();

        return $data;
    }
204237
public static function createWithDefaults(array $providers = [])
    {
        $providers = [
            [
                'type' => 'orm',
                'callable' => function ($request, $data) {
                    if (is_array($data['entity']) || $data['entity'] instanceof Traversable) {
                        $pass = (new Collection($data['entity']))->first() !== null;
                        if ($pass) {
                            return new EntityContext($request, $data);
                        }
                    }
                    if ($data['entity'] instanceof EntityInterface) {
                        return new EntityContext($request, $data);
                    }
                    if (is_array($data['entity']) && empty($data['entity']['schema'])) {
                        return new EntityContext($request, $data);
                    }
                }
            ],
            [
                'type' => 'array',
                'callable' => function ($request, $data) {
                    if (is_array($data['entity']) && isset($data['entity']['schema'])) {
                        return new ArrayContext($request, $data['entity']);
                    }
                }
            ],
            [
                'type' => 'form',
                'callable' => function ($request, $data) {
                    if ($data['entity'] instanceof Form) {
                        return new FormContext($request, $data);
                    }
                }
            ],
        ] + $providers;

        return new static($providers);
    }
833563
public function transform($entities)
    {
        if (is_null($entities) || count($entities) === 0) {
            return [];
        }

        $data = [];
        $accessor = PropertyAccess::createPropertyAccessor();

        foreach ($entities as $entity) {
            $text = is_null($this->textProperty)
                ? (string)$entity
                : $accessor->getValue($entity, $this->textProperty);
            $data[$accessor->getValue($entity, $this->primaryKey)] = [
                'text' => $text
            ];
        }

        return $data;
    }
311338
final public static function fromArrays(array $inputs) : array
    {
        Util::throwIfNotType(['array' => $inputs]);

        $entities = [];
        foreach ($inputs as $key => $input) {
            $entities[$key] = new static($input);
        }

        return $entities;
    }
1004778
public function getRepository(Entity $entity)
    {
        $repo = $this->getRepositories()[get_class($entity)];

        return $this->$repo;
    }
369033
protected function normaliseMessages($entities)
    {
        $messages = [];
        // Squash second and third levels together (class.key)
        foreach ($entities as $class => $keys) {
            // Check if namespace omits class
            if (!is_array($keys)) {
                $messages[$class] = $keys;
            } else {
                foreach ($keys as $key => $value) {
                    $fullKey = "{$class}.{$key}";
                    $messages[$fullKey] = $value;
                }
            }
        }
        ksort($messages);
        return $messages;
    }
574482
public function delete($entities)
    {
        if($entities instanceof Entity) {
            $entities = [$entities];
        }
        return $this->obj_gateway
            ->withSchema($this->obj_schema)
            ->withTransaction($this->consumeTransaction())
            ->deleteMulti($entities);
    }
1179578
public function getManagedFields($entity)
    {
        $class = get_class($entity);

        if (!isset($this->managedFields[$class])) {
            $entityClass = get_class($entity);
            $this->managedFields[$class] = array();
            do {
                $metadata = $this->metadataFactory->getMetadataForClass($entityClass);
                foreach ($metadata->propertyMetadata as $field => $metadata) {
                    if (isset($metadata->fileManager)) {
                        $this->managedFields[$class][] =$field;
                    }
                }
            } while ($entityClass = get_parent_class($entityClass));
            $this->managedFields[$class] = array_unique($this->managedFields[$class]);
        }
        return $this->managedFields[$class];
    }
422046
public static function fromArray($entity, array $array)
    {
        if (is_string($entity)) {
            $entity = InstanceHelper::createInstanceWithoutConstructor($entity);
        }

        $reflectionPropertyList = InstanceHelper::getReflectionProperties($entity);
        ClassHelper::setReflectionPropertiesAccessible($reflectionPropertyList);

        /** @var ReflectionProperty $reflectionProperty */
        foreach ($reflectionPropertyList as $reflectionProperty) {
            $propertyName = $reflectionProperty->getName();
            if (array_key_exists($propertyName, $array)) {
                $reflectionProperty->setValue($entity, $array[$propertyName]);
            }
        }

        return $entity;
    }
1265438
public function entityIdsFrom(IEntitySet $entities) : ObjectArrayFieldBuilder
    {
        return (new ObjectArrayFieldBuilder($this
            ->type(new ArrayOfObjectIdsType(
                $entities,
                Field::element()->entityIdFrom($entities)->required()->build()
            ))
        ))->containsNoDuplicates();
    }
1362252
public function extract($entity)
    {
        $metadata = $this->getMetadata();
        $collection = [];
        
        foreach ($metadata->getSQLNames() as $sqlName) {
            $propertyName = $metadata->getName($sqlName, Metadata::CAMILIZED);
            $propertyValue = $this->getReflection()->getProperty($propertyName)->getValue($entity);
            $propertyValue = $propertyValue !== null
                ? $metadata->toPlatform($metadata->getName($sqlName), $propertyValue) : null;
            $collection[$sqlName] = $propertyValue;
        }
        
        return $collection;
    }