HosipLan

Untitled

Apr 14th, 2011
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. class Page
  2. {
  3.  
  4.     /** @OneToMany(entity="SharedContent") */
  5.     private $sharedContents;
  6.  
  7.     /** @ManyToOne(entity="PageType") */
  8.     private $pageType; // výchozí ArrayCollection přes constructor
  9.  
  10. }
  11.  
  12. class PageType
  13. {
  14.  
  15.     /** @OneToMany(entity="Page") */
  16.     private $pages; // výchozí ArrayCollection přes constructor
  17.  
  18.     /** @ManyToMany(entity="SharedContentType") */
  19.     private $sharedContentTypes; // výchozí ArrayCollection přes constructor
  20.  
  21. }
  22.  
  23. class SharedContentType
  24. {
  25.     /** @ManyToMany(entity="PageType") */
  26.     private $pageTypes; // výchozí ArrayCollection přes constructor
  27.  
  28.     /** @OneToMany(entity="SharedContent") */
  29.     private $sharedContents;
  30. }
  31.  
  32. class SharedContent
  33. {
  34.  
  35.     /** @ManyToOne(entity="SharedContent") */
  36.     private $page;
  37.  
  38.     /** @ManyToOne(entity="SharedContentType") */
  39.     private $type;
  40.  
  41. }
  42.  
  43.  
  44. // typy pro page
  45. $em->getRepository('PageType')->createQueryBuilder('pt')
  46.     ->innerJoin('pt.sharedContentTypes', 'ct');
  47.  
  48. // globální typy
  49. $em->getRepository('SharedContentType')->createQueryBuilder('ct')
  50.     ->leftJoin('pt.pageTypes', 'pt')
  51.     ->where('pt.id IS NULL');
Advertisement
Add Comment
Please, Sign In to add comment