FollowGroup.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. namespace Muzich\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. /**
  6. * Cet entité est le lien entre un User et un Group. Pour exprimer que
  7. * le follower suit un Groupe.
  8. *
  9. * @ORM\Entity
  10. * @ORM\Table(name="follow_group")
  11. */
  12. class FollowGroup
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\generatedValue(strategy="AUTO")
  18. */
  19. protected $id;
  20. /**
  21. * Ee suiveur
  22. *
  23. * @ORM\ManyToOne(targetEntity="User", inversedBy="followed_groups")
  24. * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  25. */
  26. protected $follower;
  27. /**
  28. * Groupe suivis
  29. *
  30. * @ORM\ManyToOne(targetEntity="Group", inversedBy="followers")
  31. * @ORM\JoinColumn(name="group_id", referencedColumnName="id", onDelete="CASCADE")
  32. */
  33. protected $group;
  34. /**
  35. * Get id
  36. *
  37. * @return integer
  38. */
  39. public function getId()
  40. {
  41. return $this->id;
  42. }
  43. /**
  44. * Set follower
  45. *
  46. * @param User $follower
  47. */
  48. public function setFollower(User $follower)
  49. {
  50. $this->follower = $follower;
  51. }
  52. /**
  53. * Get follower
  54. *
  55. * @return User
  56. */
  57. public function getFollower()
  58. {
  59. return $this->follower;
  60. }
  61. /**
  62. * Set group
  63. *
  64. * @param Group $group
  65. */
  66. public function setGroup(Group $group)
  67. {
  68. $this->group = $group;
  69. }
  70. /**
  71. * Get group
  72. *
  73. * @return Group
  74. */
  75. public function getGroup()
  76. {
  77. return $this->group;
  78. }
  79. /**
  80. * Retourne le groupe suivis
  81. *
  82. * @return Group
  83. */
  84. public function getFollowed()
  85. {
  86. return $this->group;
  87. }
  88. }