/**
* Create a new entity manager
*
* @param DriverInterface $driver
* @param MapperInterface $mapper
* @param SerialiserMap $serialiser_map
* @param KeySchemeInterface $key_scheme
* @param Configuration $configuration
* @param EntityCachingInterface $cache
* @return EntityManager
*/
public static function build(DriverInterface $driver, MapperInterface $mapper, SerialiserMap $serialiser_map = null, KeySchemeInterface $key_scheme = null, Configuration $configuration = null, EntityCachingInterface $cache = null)
{
$em_conf = $configuration ?: new Configuration();
$proxy_conf = new \ProxyManager\Configuration();
$proxy_conf->setProxiesTargetDir($em_conf->getCacheDir());
$proxy_conf->setProxiesNamespace(Writer::PROXY_NAMESPACE);
$proxy_factory = new AccessInterceptorValueHolderFactory($proxy_conf);
$interceptor_factor = new EntityManagerInterceptorFactory();
$em = new self($driver, $mapper, $serialiser_map, $key_scheme, $em_conf, $cache);
$proxy = $proxy_factory->createProxy($em, $interceptor_factor->getPrefixInterceptors(), $interceptor_factor->getSuffixInterceptors());
$em->setProxy($proxy);
return $proxy;
}