PaginationTestCase.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace Doctrine\Tests\ORM\Tools\Pagination;
  3. use Doctrine\Tests\OrmTestCase;
  4. abstract class PaginationTestCase extends OrmTestCase
  5. {
  6. public $entityManager;
  7. public function setUp()
  8. {
  9. $this->entityManager = $this->_getTestEntityManager();
  10. }
  11. }
  12. /**
  13. * @Entity
  14. */
  15. class MyBlogPost
  16. {
  17. /** @Id @column(type="integer") @generatedValue */
  18. public $id;
  19. /**
  20. * @ManyToOne(targetEntity="Author")
  21. */
  22. public $author;
  23. /**
  24. * @ManyToOne(targetEntity="Category")
  25. */
  26. public $category;
  27. }
  28. /**
  29. * @Entity
  30. */
  31. class MyAuthor
  32. {
  33. /** @Id @column(type="integer") @generatedValue */
  34. public $id;
  35. }
  36. /**
  37. * @Entity
  38. */
  39. class MyCategory
  40. {
  41. /** @id @column(type="integer") @generatedValue */
  42. public $id;
  43. }
  44. /**
  45. * @Entity
  46. */
  47. class BlogPost
  48. {
  49. /** @Id @column(type="integer") @generatedValue */
  50. public $id;
  51. /**
  52. * @ManyToOne(targetEntity="Author")
  53. */
  54. public $author;
  55. /**
  56. * @ManyToOne(targetEntity="Category")
  57. */
  58. public $category;
  59. }
  60. /**
  61. * @Entity
  62. */
  63. class Author
  64. {
  65. /** @Id @column(type="integer") @generatedValue */
  66. public $id;
  67. /** @Column(type="string") */
  68. public $name;
  69. }
  70. /**
  71. * @Entity
  72. */
  73. class Person
  74. {
  75. /** @Id @column(type="integer") @generatedValue */
  76. public $id;
  77. /** @Column(type="string") */
  78. public $name;
  79. /** @Column(type="string") */
  80. public $biography;
  81. }
  82. /**
  83. * @Entity
  84. */
  85. class Category
  86. {
  87. /** @id @column(type="integer") @generatedValue */
  88. public $id;
  89. }
  90. /** @Entity @Table(name="groups") */
  91. class Group
  92. {
  93. /** @Id @column(type="integer") @generatedValue */
  94. public $id;
  95. /** @ManyToMany(targetEntity="User", mappedBy="groups") */
  96. public $users;
  97. }
  98. /** @Entity */
  99. class User
  100. {
  101. /** @Id @column(type="integer") @generatedValue */
  102. public $id;
  103. /**
  104. * @ManyToMany(targetEntity="Group", inversedBy="users")
  105. * @JoinTable(
  106. * name="user_group",
  107. * joinColumns = {@JoinColumn(name="user_id", referencedColumnName="id")},
  108. * inverseJoinColumns = {@JoinColumn(name="group_id", referencedColumnName="id")}
  109. * )
  110. */
  111. public $groups;
  112. }