Guest User

Untitled

a guest
Jul 25th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. namespace Doctrine\Tests\Models\GeoLocation;
  2.  
  3. /**
  4. * Description of Location
  5. *
  6. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  7. * @Entity
  8. * @Table(name="locations")
  9. * @InheritanceType("JOINED")
  10. * @DiscriminatorColumn(name="type", type="string")
  11. * @DiscriminatorMap({
  12. * "user" = "User",
  13. * "point" = "Point",
  14. * "poi" = "PointOfInterest",
  15. * "map" = "Map"
  16. * })
  17. */
  18. abstract class Location
  19. {
  20. /**
  21. * @Id
  22. * @Column(type="integer")
  23. * @GeneratedValue(strategy="AUTO")
  24. */
  25. private $id;
  26.  
  27. /**
  28. * @Column(type="decimal", length=10)
  29. */
  30. private $latitude;
  31.  
  32. /**
  33. * @Column(type="decimal", length=10)
  34. */
  35. private $longitude;
  36.  
  37. // ...
  38. }
  39.  
  40.  
  41. /**
  42. * Description of User
  43. *
  44. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  45. * @Entity
  46. * @Table(name="users")
  47. */
  48. class User extends Location
  49. {
  50. /**
  51. * @Column(type="string", length=255)
  52. */
  53. private $name;
  54.  
  55. /**
  56. * @OneToMany(targetEntity="Map", mappedBy="creator")
  57. */
  58. public $maps;
  59.  
  60. // ...
  61. }
  62.  
  63.  
  64. /**
  65. * Description of Point
  66. *
  67. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  68. * @Entity
  69. * @Table(name="points")
  70. */
  71. class Point extends Location
  72. {
  73. }
  74.  
  75.  
  76. /**
  77. * Description of PointOfInterest
  78. *
  79. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  80. * @Entity
  81. * @Table(name="pois")
  82. */
  83. class PointOfInterest extends Point
  84. {
  85. /**
  86. * @Column(type="string", length=255)
  87. */
  88. private $name;
  89.  
  90. // ...
  91. }
  92.  
  93.  
  94. /**
  95. * Description of Map
  96. *
  97. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  98. * @Entity
  99. * @Table(name="maps")
  100. */
  101. class Map extends Point
  102. {
  103. /**
  104. * @Column(type="string", length=255)
  105. */
  106. private $name;
  107.  
  108. /**
  109. * @Column(type="integer")
  110. */
  111. private $zoom;
  112.  
  113. /**
  114. * @ManyToOne(targetEntity="User")
  115. * @JoinColumn(name="user_id", referencedColumnName="id")
  116. */
  117. private $creator;
  118.  
  119. // ...
  120. }
Add Comment
Please, Sign In to add comment