FollowUser.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 deux User. Pour exprimer que
  7. * le follower suit un followed.
  8. *
  9. * @ORM\Entity
  10. * @ORM\Table(name="follow_user")
  11. */
  12. class FollowUser
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\generatedValue(strategy="AUTO")
  18. */
  19. protected $id;
  20. /**
  21. * User suiveur
  22. *
  23. * @ORM\ManyToOne(targetEntity="User", inversedBy="followeds_users")
  24. * @ORM\JoinColumn(name="follower_id", referencedColumnName="id")
  25. */
  26. protected $follower;
  27. /**
  28. * User suivis
  29. *
  30. * @ORM\ManyToOne(targetEntity="User", inversedBy="followers_users")
  31. * @ORM\JoinColumn(name="followed_id", referencedColumnName="id")
  32. */
  33. protected $followed;
  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 followed
  63. *
  64. * @param User $followed
  65. */
  66. public function setFollowed(User $followed)
  67. {
  68. $this->followed = $followed;
  69. }
  70. /**
  71. * Get followed
  72. *
  73. * @return User
  74. */
  75. public function getFollowed()
  76. {
  77. return $this->followed;
  78. }
  79. }