Bravo3\Orm\Services\EntityManager::__construct PHP Method

__construct() protected method

Do not construct an entity manager directly or it will lack access interceptors which are responsible for caching and event dispatching.
See also: EntityManager::build()
protected __construct ( Bravo3\Orm\Drivers\DriverInterface $driver, Bravo3\Orm\Mappers\MapperInterface $mapper, SerialiserMap $serialiser_map = null, Bravo3\Orm\KeySchemes\KeySchemeInterface $key_scheme = null, Configuration $configuration = null, Bravo3\Orm\Services\Cache\EntityCachingInterface $cache = null )
$driver Bravo3\Orm\Drivers\DriverInterface
$mapper Bravo3\Orm\Mappers\MapperInterface
$serialiser_map Bravo3\Orm\Serialisers\SerialiserMap
$key_scheme Bravo3\Orm\KeySchemes\KeySchemeInterface
$configuration Bravo3\Orm\Config\Configuration
$cache Bravo3\Orm\Services\Cache\EntityCachingInterface
    protected function __construct(DriverInterface $driver, MapperInterface $mapper, SerialiserMap $serialiser_map = null, KeySchemeInterface $key_scheme = null, Configuration $configuration = null, EntityCachingInterface $cache = null)
    {
        $this->driver = $driver;
        $this->mapper = $mapper;
        $this->key_scheme = $key_scheme ?: $driver->getPreferredKeyScheme();
        $this->config = $configuration ?: new Configuration();
        $this->cache = $cache ?: new EphemeralEntityCache();
        if ($serialiser_map) {
            $this->serialiser_map = $serialiser_map;
        } else {
            $this->serialiser_map = new SerialiserMap();
            $this->serialiser_map->addSerialiser(new JsonSerialiser());
        }
        $this->instance_id = uniqid();
        $this->registerDefaultSubscribers();
    }