HosipLan

Untitled

May 25th, 2011
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. class ModelFactory extends Nette\Object
  2. {
  3.  
  4.     public static function createServiceArticles(Nette\DI\Container $container)
  5.     {
  6.         $em = $container->doctrine->entityManager;
  7.         return new Articles($em->getRepository('App\Article'), $container->fileStorage);
  8.     }
  9.  
  10. }
  11.  
  12.  
  13. class Articles extends Nette\Object
  14. {
  15.  
  16.     public function __construct(Doctrine\ORM\EntityRepository $repository, Nette\Caching\Storages\IStorage $fileStorage)
  17.     {
  18.         $this->repository = $repository;
  19.         $this->cache = new Nette\Caching\Cache($fileStorage, 'app.clanky');
  20.     }
  21. }
  22.  
  23.  
  24.  
  25. /* ...... config
  26.  
  27. services:
  28.     articles:
  29.         factory: ModelFactory::createServiceArticles
Advertisement
Add Comment
Please, Sign In to add comment