BasePHPCRManager.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\CoreBundle\Model;
  11. use Doctrine\Common\Persistence\ObjectManager;
  12. abstract class BasePHPCRManager extends BaseManager
  13. {
  14. /**
  15. * Make sure the code is compatible with legacy code.
  16. *
  17. * @param $name
  18. *
  19. * @return mixed
  20. */
  21. public function __get($name)
  22. {
  23. if ($name === 'dm') {
  24. return $this->getObjectManager();
  25. }
  26. throw new \RuntimeException(sprintf('The property %s does not exists', $name));
  27. }
  28. /**
  29. * {@inheritdoc}
  30. *
  31. * @throws \LogicException Each call
  32. */
  33. public function getConnection()
  34. {
  35. throw new \LogicException('PHPCR does not use a database connection.');
  36. }
  37. /**
  38. * {@inheritdoc}
  39. *
  40. * @throws \LogicException Each call
  41. */
  42. public function getTableName()
  43. {
  44. throw new \LogicException('PHPCR does not use a reference name for a list of data.');
  45. }
  46. /**
  47. * @return ObjectManager
  48. */
  49. public function getDocumentManager()
  50. {
  51. return $this->getObjectManager();
  52. }
  53. }