src/Products/NotificationsBundle/Entity/ProfileRelationship.php line 21

Open in your IDE?
  1. <?php
  2. namespace Products\NotificationsBundle\Entity;
  3. use Cms\CoreBundle\Model\Interfaces\OneRosterable\OneRosterableInterface;
  4. use Cms\CoreBundle\Model\Interfaces\OneRosterable\OneRosterableTrait;
  5. use Cms\TenantBundle\Entity\TenantedEntity;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * Class ProfileRelationship
  9.  * @package Products\NotificationsBundle\Entity
  10.  *
  11.  * @ORM\Entity(
  12.  *     repositoryClass = "Products\NotificationsBundle\Doctrine\Repository\ProfileRelationshipRepository",
  13.  * )
  14.  * @ORM\Table(
  15.  *     name = "notis__profile_relationship",
  16.  * )
  17.  */
  18. class ProfileRelationship extends TenantedEntity implements OneRosterableInterface
  19. {
  20.     use OneRosterableTrait;
  21.     /**
  22.      * @var Profile|null
  23.      *
  24.      * @ORM\ManyToOne(
  25.      *     targetEntity = "Products\NotificationsBundle\Entity\Profile",
  26.      *     inversedBy = "relationships",
  27.      * )
  28.      * @ORM\JoinColumn(
  29.      *     name = "profile",
  30.      *     referencedColumnName = "id",
  31.      *     nullable = true,
  32.      *     onDelete = "CASCADE",
  33.      * )
  34.      */
  35.     protected ?Profile $profile null;
  36.     /**
  37.      * @var Student|null
  38.      *
  39.      * @ORM\ManyToOne(
  40.      *     targetEntity = "Products\NotificationsBundle\Entity\Student",
  41.      *     inversedBy = "relationships",
  42.      * )
  43.      * @ORM\JoinColumn(
  44.      *     name = "student",
  45.      *     referencedColumnName = "id",
  46.      *     nullable = true,
  47.      *     onDelete = "CASCADE",
  48.      * )
  49.      */
  50.     protected ?Student $student null;
  51.     /**
  52.      * @var array|null
  53.      *
  54.      * @ORM\Column(
  55.      *     type = "json",
  56.      *     nullable = true,
  57.      * )
  58.      */
  59.     protected ?array $metadata = [];
  60.     /**
  61.      * @return Profile|null
  62.      */
  63.     public function getProfile(): ?Profile
  64.     {
  65.         return $this->profile;
  66.     }
  67.     /**
  68.      * @param Profile $profile
  69.      * @return $this
  70.      */
  71.     public function setProfile(Profile $profile): self
  72.     {
  73.         $this->profile $profile;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return Student|null
  78.      */
  79.     public function getStudent(): ?Student
  80.     {
  81.         return $this->student;
  82.     }
  83.     /**
  84.      * @param Student $student
  85.      * @return $this
  86.      */
  87.     public function setStudent(Student $student): self
  88.     {
  89.         $this->student $student;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return array
  94.      */
  95.     public function getMetadata(): array
  96.     {
  97.         return $this->metadata ?? [];
  98.     }
  99.     /**
  100.      * @param array|null $metadata
  101.      * @return $this
  102.      */
  103.     public function setMetadata(?array $metadata): self
  104.     {
  105.         $this->metadata $metadata ?: null;
  106.         return $this;
  107.     }
  108. }