src/Entity/Friendship.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. #[ORM\Entity]
  5. #[ORM\Table(name'friendship')]
  6. class Friendship
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue(strategy'AUTO')]
  10.     #[ORM\Column(type'integer'uniquetrue)]
  11.     private $id;
  12.     #[ORM\ManyToOne(targetEntity'App\Entity\Person'inversedBy'myFriends'fetch'EXTRA_LAZY')]
  13.     #[ORM\JoinColumn(name'user'referencedColumnName'id'nullablefalse,onDelete:'CASCADE' )]
  14.     private $user;
  15.     #[ORM\ManyToOne(targetEntity'App\Entity\Person'inversedBy'friendsWithMe'fetch'EXTRA_LAZY')]
  16.     #[ORM\JoinColumn(name'friend'referencedColumnName'id' )]
  17.     private $friend;
  18.     #[ORM\Column(name'is_accepted'type'boolean')]
  19.     private $isAccepted;
  20.     /**
  21.      * @return int
  22.      */
  23.     public function getId()
  24.     {
  25.         return $this->id;
  26.     }
  27.     /**
  28.      * @param int $id
  29.      */
  30.     public function setId($id)
  31.     {
  32.         $this->id $id;
  33.     }
  34.     /**
  35.      * @return number
  36.      */
  37.     public function getUser()
  38.     {
  39.         return $this->user->getId();
  40.     }
  41.     /**
  42.      * @param Person $user
  43.      */
  44.     public function setUser($user)
  45.     {
  46.         $this->user $user;
  47.     }
  48.     /**
  49.      * @return number
  50.      */
  51.     public function getFriend()
  52.     {
  53.         return $this->friend->getId();
  54.     }
  55.     /**
  56.      * @param Person $friend
  57.      */
  58.     public function setFriend($friend)
  59.     {
  60.         $this->friend $friend;
  61.     }
  62.     /**
  63.      * @return bool
  64.      */
  65.     public function isAccepted()
  66.     {
  67.         return $this->isAccepted;
  68.     }
  69.     /**
  70.      * @param bool $isAccepted
  71.      */
  72.     public function setIsAccepted($isAccepted)
  73.     {
  74.         $this->isAccepted $isAccepted;
  75.     }
  76. }