HosipLan

Untitled

Jun 23rd, 2011
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * This file is part of the Kdyby (http://www.kdyby.org)
  5.  *
  6.  * Copyright (c) 2008, 2011 Filip Procházka ([email protected])
  7.  *
  8.  * @license http://www.kdyby.org/license
  9.  */
  10.  
  11. namespace Kdyby\Doctrine\ORM\Mapping;
  12.  
  13. use Doctrine;
  14. use Doctrine\ORM\Events;
  15. use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
  16. use Kdyby;
  17. use Nette;
  18.  
  19.  
  20.  
  21. /**
  22.  * @author Filip Procházka
  23.  */
  24. class EntityDefaultsListener extends Nette\Object implements Doctrine\Common\EventSubscriber
  25. {
  26.  
  27.     /**
  28.      * @return array
  29.      */
  30.     public function getSubscribedEvents()
  31.     {
  32.         return array(
  33.             Events::loadClassMetadata,
  34.         );
  35.     }
  36.  
  37.  
  38.  
  39.     /**
  40.      * @param LoadClassMetadataEventArgs $args
  41.      */
  42.     public function loadClassMetadata(LoadClassMetadataEventArgs $args)
  43.     {
  44.         $meta = $args->getClassMetadata();
  45.         if (!$meta->customRepositoryClassName) {
  46.             $meta->customRepositoryClassName = 'Kdyby\Doctrine\ORM\EntityRepository';
  47.         }
  48.     }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment