This repository has been archived on 2026-07-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
espocrm-base/application/Espo/ORM/EntityFactory.php
T
2014-01-24 12:14:47 +02:00

26 lines
485 B
PHP

<?php
namespace Espo\ORM;
class EntityFactory
{
protected $metadata;
protected $entityManager;
public function __construct(EntityManager $entityManager, Metadata $metadata)
{
$this->entityManager = $entityManager;
$this->metadata = $metadata;
}
public function create($name)
{
$className = $this->entityManager->normalizeEntityName($name);
$defs = $this->metadata->get($name);
$entity = new $className($defs, $this->entityManager);
return $entity;
}
}