Skip to content

Commit

Permalink
Fixed issue: [181](graphaware#181) . Added missed methods that implem…
Browse files Browse the repository at this point in the history
…ented in EntityManager to EntityManagerInterface.
  • Loading branch information
gmanaev committed Jan 22, 2019
1 parent 926f0f7 commit 6517e42
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ class EntityManager implements EntityManagerInterface
*/
protected $entityPersisters = [];

/**
* EntityManager constructor.
*
* @param ClientInterface $databaseDriver
* @param null|string $cacheDirectory
* @param null|EventManager $eventManager
* @param null|GraphEntityMetadataFactoryInterface $metadataFactory
*
* @throws \Doctrine\Common\Annotations\AnnotationException
*/
public function __construct(
ClientInterface $databaseDriver,
$cacheDirectory = null,
Expand All @@ -106,11 +116,7 @@ public function __construct(
}

/**
* @param string $host
* @param string|null $cacheDir
* @param EventManager|null $eventManager
*
* @return EntityManager
* {@inheritdoc}
*/
public static function create($host, $cacheDir = null, EventManager $eventManager = null)
{
Expand Down Expand Up @@ -194,11 +200,17 @@ public function getMetadataFactory()
return $this->metadataFactory;
}

/**
* {@inheritdoc}
*/
public function initializeObject($obj)
{
$this->uow->initializeObject($obj);
}

/**
* {@inheritdoc}
*/
public function contains($entity)
{
return $this->uow->isScheduledForCreate($entity)
Expand Down Expand Up @@ -361,14 +373,16 @@ public function getEntityHydrator($className)
return $this->entityHydrators[$className];
}

/**
* {@inheritdoc}
*/
public function getEntityPersister($className)
{
return new BasicEntityPersister($className, $this->getClassMetadataFor($className), $this);
}

/**
* @param string $cql
* @return Query
* {@inheritdoc}
*/
public function createQuery($cql = '')
{
Expand All @@ -381,6 +395,9 @@ public function createQuery($cql = '')
return $query;
}

/**
* {@inheritdoc}
*/
public function registerPropertyConverter($name, $classname)
{
Converter::addConverter($name, $classname);
Expand Down
56 changes: 56 additions & 0 deletions src/EntityManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,22 @@

use Doctrine\Common\EventManager;
use Doctrine\Common\Persistence\ObjectManager;
use GraphAware\Neo4j\OGM\Hydrator\EntityHydrator;
use GraphAware\Neo4j\OGM\Metadata\NodeEntityMetadata;
use GraphAware\Neo4j\OGM\Persisters\BasicEntityPersister;
use GraphAware\Neo4j\OGM\Proxy\ProxyFactory;

interface EntityManagerInterface extends ObjectManager
{
/**
* @param string $host
* @param null|string $cacheDir
* @param null|EventManager $eventManager
*
* @return EntityManagerInterface
*/
public static function create($host, $cacheDir = null, EventManager $eventManager = null);

/**
* @return EventManager
*/
Expand Down Expand Up @@ -60,4 +73,47 @@ public function getRelationshipEntityMetadata($class);
* @return \GraphAware\Neo4j\OGM\Repository\BaseRepository
*/
public function getRepository($class);

/**
* @return string
*/
public function getProxyDirectory();

/**
* @param NodeEntityMetadata $entityMetadata
*
* @return ProxyFactory
*/
public function getProxyFactory(NodeEntityMetadata $entityMetadata);

/**
* @param string $className
*
* @return EntityHydrator
*/
public function getEntityHydrator($className);

/**
* @param string $className
*
* @return BasicEntityPersister
*/
public function getEntityPersister($className);

/**
* @param string $cql
*
* @return Query
*/
public function createQuery($cql = '');

/**
* @param string $name
* @param string $classname
*
* @return void
*/
public function registerPropertyConverter($name, $classname);

public function getAnnotationDriver();
}

0 comments on commit 6517e42

Please sign in to comment.