Several fixes
parent
39f910d7e1
commit
90a2f5594d
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace BitCommunism\Doctrine\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class Lorem
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue()
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace BitCommunism\Doctrine;
|
||||
|
||||
|
||||
interface EntityManager
|
||||
{
|
||||
public function getResponsibleEntityManager(string $name): DefaultEntityManager;
|
||||
public function find($className, $id);
|
||||
public function persist($object);
|
||||
public function remove($object);
|
||||
public function merge($object);
|
||||
public function clear($objectName = null);
|
||||
public function detach($object);
|
||||
public function refresh($object);
|
||||
public function flush($entity = null);
|
||||
public function getRepository($className);
|
||||
public function getClassMetadata($className);
|
||||
public function initializeObject($object);
|
||||
public function contains($object);
|
||||
public function close();
|
||||
public function copy($entity, $deep = false);
|
||||
public function lock($entity, $lockMode, $lockVersion = null);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace BitCommunism\Doctrine;
|
||||
|
||||
|
||||
interface EntityManagerLike
|
||||
{
|
||||
public function getEntityManager(string $name): DefaultEntityManager;
|
||||
public function find($className, $id);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace BitCommunism\Doctrine;
|
||||
|
||||
use function DI\add;
|
||||
use DI\Definition\EntryReference;
|
||||
|
||||
if (!function_exists(__NAMESPACE__ . '\\connections')) {
|
||||
/**
|
||||
* @param $connections
|
||||
* @return array
|
||||
*/
|
||||
function connections($connections) {
|
||||
$connectionNames = [];
|
||||
|
||||
$entityPaths = [];
|
||||
$connectionInfos = [];
|
||||
|
||||
foreach ($connections as $name => $connection) {
|
||||
$connectionNames[] = $name;
|
||||
|
||||
$entityPaths['doctrine.entity-paths.' . $name] = $connection['entity-paths'] instanceof EntryReference ? $connection['entity-paths'] : add($connection['entity-paths'] ?? []);
|
||||
$entityPaths['doctrine.connection.' . $name] = $connection['connection'] instanceof EntryReference ? $connection['connection'] : add($connection['connection'] ?? []);
|
||||
}
|
||||
|
||||
|
||||
return array_merge(
|
||||
[
|
||||
'doctrine.connections' => add($connectionNames),
|
||||
],
|
||||
$entityPaths,
|
||||
$connectionInfos
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue