vendor/doctrine/orm/src/Decorator/EntityManagerDecorator.php line 59

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\ORM\Decorator;
  4. use Doctrine\Deprecations\Deprecation;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Doctrine\ORM\EntityRepository;
  7. use Doctrine\ORM\Query\ResultSetMapping;
  8. use Doctrine\Persistence\ObjectManagerDecorator;
  9. use function func_get_arg;
  10. use function func_num_args;
  11. use function get_debug_type;
  12. use function method_exists;
  13. use function sprintf;
  14. use function trigger_error;
  15. use const E_USER_NOTICE;
  16. /**
  17.  * Base class for EntityManager decorators
  18.  *
  19.  * @extends ObjectManagerDecorator<EntityManagerInterface>
  20.  */
  21. abstract class EntityManagerDecorator extends ObjectManagerDecorator implements EntityManagerInterface
  22. {
  23.     public function __construct(EntityManagerInterface $wrapped)
  24.     {
  25.         $this->wrapped $wrapped;
  26.     }
  27.     /**
  28.      * {@inheritDoc}
  29.      */
  30.     public function getConnection()
  31.     {
  32.         return $this->wrapped->getConnection();
  33.     }
  34.     /**
  35.      * {@inheritDoc}
  36.      */
  37.     public function getExpressionBuilder()
  38.     {
  39.         return $this->wrapped->getExpressionBuilder();
  40.     }
  41.     /**
  42.      * {@inheritDoc}
  43.      *
  44.      * @psalm-param class-string<T> $className
  45.      *
  46.      * @psalm-return EntityRepository<T>
  47.      *
  48.      * @template T of object
  49.      */
  50.     public function getRepository($className)
  51.     {
  52.         return $this->wrapped->getRepository($className);
  53.     }
  54.     /**
  55.      * {@inheritDoc}
  56.      */
  57.     public function getClassMetadata($className)
  58.     {
  59.         return $this->wrapped->getClassMetadata($className);
  60.     }
  61.     /**
  62.      * {@inheritDoc}
  63.      */
  64.     public function beginTransaction()
  65.     {
  66.         $this->wrapped->beginTransaction();
  67.     }
  68.     /**
  69.      * {@inheritDoc}
  70.      */
  71.     public function transactional($func)
  72.     {
  73.         return $this->wrapped->transactional($func);
  74.     }
  75.     /**
  76.      * {@inheritDoc}
  77.      */
  78.     public function wrapInTransaction(callable $func)
  79.     {
  80.         if (! method_exists($this->wrapped'wrapInTransaction')) {
  81.             trigger_error(
  82.                 sprintf('Calling `transactional()` instead of `wrapInTransaction()` which is not implemented on %s'get_debug_type($this->wrapped)),
  83.                 E_USER_NOTICE
  84.             );
  85.             return $this->wrapped->transactional($func);
  86.         }
  87.         return $this->wrapped->wrapInTransaction($func);
  88.     }
  89.     /**
  90.      * {@inheritDoc}
  91.      */
  92.     public function commit()
  93.     {
  94.         $this->wrapped->commit();
  95.     }
  96.     /**
  97.      * {@inheritDoc}
  98.      */
  99.     public function rollback()
  100.     {
  101.         $this->wrapped->rollback();
  102.     }
  103.     /**
  104.      * {@inheritDoc}
  105.      */
  106.     public function createQuery($dql '')
  107.     {
  108.         return $this->wrapped->createQuery($dql);
  109.     }
  110.     /**
  111.      * {@inheritDoc}
  112.      */
  113.     public function createNamedQuery($name)
  114.     {
  115.         return $this->wrapped->createNamedQuery($name);
  116.     }
  117.     /**
  118.      * {@inheritDoc}
  119.      */
  120.     public function createNativeQuery($sqlResultSetMapping $rsm)
  121.     {
  122.         return $this->wrapped->createNativeQuery($sql$rsm);
  123.     }
  124.     /**
  125.      * {@inheritDoc}
  126.      */
  127.     public function createNamedNativeQuery($name)
  128.     {
  129.         return $this->wrapped->createNamedNativeQuery($name);
  130.     }
  131.     /**
  132.      * {@inheritDoc}
  133.      */
  134.     public function createQueryBuilder()
  135.     {
  136.         return $this->wrapped->createQueryBuilder();
  137.     }
  138.     /**
  139.      * {@inheritDoc}
  140.      */
  141.     public function getReference($entityName$id)
  142.     {
  143.         return $this->wrapped->getReference($entityName$id);
  144.     }
  145.     /**
  146.      * {@inheritDoc}
  147.      */
  148.     public function getPartialReference($entityName$identifier)
  149.     {
  150.         Deprecation::trigger(
  151.             'doctrine/orm',
  152.             'https://github.com/doctrine/orm/pull/10987',
  153.             'Method %s is deprecated and will be removed in 3.0.',
  154.             __METHOD__
  155.         );
  156.         return $this->wrapped->getPartialReference($entityName$identifier);
  157.     }
  158.     /**
  159.      * {@inheritDoc}
  160.      */
  161.     public function close()
  162.     {
  163.         $this->wrapped->close();
  164.     }
  165.     /**
  166.      * {@inheritDoc}
  167.      */
  168.     public function copy($entity$deep false)
  169.     {
  170.         return $this->wrapped->copy($entity$deep);
  171.     }
  172.     /**
  173.      * {@inheritDoc}
  174.      */
  175.     public function lock($entity$lockMode$lockVersion null)
  176.     {
  177.         $this->wrapped->lock($entity$lockMode$lockVersion);
  178.     }
  179.     /**
  180.      * {@inheritDoc}
  181.      */
  182.     public function find($className$id$lockMode null$lockVersion null)
  183.     {
  184.         return $this->wrapped->find($className$id$lockMode$lockVersion);
  185.     }
  186.     /**
  187.      * {@inheritDoc}
  188.      */
  189.     public function flush($entity null)
  190.     {
  191.         $this->wrapped->flush($entity);
  192.     }
  193.     /**
  194.      * {@inheritDoc}
  195.      */
  196.     public function refresh($object)
  197.     {
  198.         $lockMode null;
  199.         if (func_num_args() > 1) {
  200.             $lockMode func_get_arg(1);
  201.         }
  202.         $this->wrapped->refresh($object$lockMode);
  203.     }
  204.     /**
  205.      * {@inheritDoc}
  206.      */
  207.     public function getEventManager()
  208.     {
  209.         return $this->wrapped->getEventManager();
  210.     }
  211.     /**
  212.      * {@inheritDoc}
  213.      */
  214.     public function getConfiguration()
  215.     {
  216.         return $this->wrapped->getConfiguration();
  217.     }
  218.     /**
  219.      * {@inheritDoc}
  220.      */
  221.     public function isOpen()
  222.     {
  223.         return $this->wrapped->isOpen();
  224.     }
  225.     /**
  226.      * {@inheritDoc}
  227.      */
  228.     public function getUnitOfWork()
  229.     {
  230.         return $this->wrapped->getUnitOfWork();
  231.     }
  232.     /**
  233.      * {@inheritDoc}
  234.      */
  235.     public function getHydrator($hydrationMode)
  236.     {
  237.         return $this->wrapped->getHydrator($hydrationMode);
  238.     }
  239.     /**
  240.      * {@inheritDoc}
  241.      */
  242.     public function newHydrator($hydrationMode)
  243.     {
  244.         return $this->wrapped->newHydrator($hydrationMode);
  245.     }
  246.     /**
  247.      * {@inheritDoc}
  248.      */
  249.     public function getProxyFactory()
  250.     {
  251.         return $this->wrapped->getProxyFactory();
  252.     }
  253.     /**
  254.      * {@inheritDoc}
  255.      */
  256.     public function getFilters()
  257.     {
  258.         return $this->wrapped->getFilters();
  259.     }
  260.     /**
  261.      * {@inheritDoc}
  262.      */
  263.     public function isFiltersStateClean()
  264.     {
  265.         return $this->wrapped->isFiltersStateClean();
  266.     }
  267.     /**
  268.      * {@inheritDoc}
  269.      */
  270.     public function hasFilters()
  271.     {
  272.         return $this->wrapped->hasFilters();
  273.     }
  274.     /**
  275.      * {@inheritDoc}
  276.      */
  277.     public function getCache()
  278.     {
  279.         return $this->wrapped->getCache();
  280.     }
  281. }