Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use JMS\Serializer\Annotation as Serializer;
- use JMS\Serializer\Annotation\Groups;
- /**
- * Button
- *
- * @Serializer\ExclusionPolicy("all")
- * @ORM\Table(name="buttons")
- * @ORM\Entity(repositoryClass="AppBundle\Repository\ButtonRepository")
- */
- class Button
- {
- /**
- * @var int
- *
- * @Serializer\Expose()
- * @Groups({"test"})
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @Serializer\Expose()
- * @Groups({"history", "historyDetails", "test", "line", "lineEdit", "reportDetails", "agroupDetails"})
- * @ORM\Column(name="name", type="string", length=255)
- */
- private $name;
- /**
- * @var boolean
- * @Serializer\Expose()
- * @ORM\Column(name="state", type="boolean")
- */
- private $state;
- /**
- * @var boolean
- * @Serializer\Expose()
- * @Groups({"history", "lineEdit"})
- * @ORM\Column(name="is_reported", type="boolean")
- */
- private $isReported;
- /**
- * @Serializer\Expose()
- * @Groups({"history", "historyDetails", "agroupDetails", "reportDetails"})
- * Many Buttons have One Line
- * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Line", inversedBy="buttons")
- * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
- */
- private $line;
- /**
- * @Serializer\Expose()
- * Many Buttons have Many AssignmentGroups.
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\AssignmentGroup", inversedBy="buttons")
- * @ORM\JoinTable(name="buttons_assignmentGroups")
- */
- private $assignmentGroups;
- /**
- * @ORM\OneToMany(targetEntity="AppBundle\Entity\History", mappedBy="button", cascade={"persist"})
- */
- private $historyEntries;
- public function __construct()
- {
- $this->assignmentGroups = new ArrayCollection();
- }
- /**
- * @Serializer\VirtualProperty()
- * @Serializer\SerializedName("assignmentGroups")
- * @Groups({"lineEdit"})
- */
- public function getOnlyId()
- {
- return $this->getAssignmentGroups()->map(function ($i) { return $i->getId(); });
- }
- /**
- * Get id
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Get name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set name
- *
- * @param string $name
- *
- * @return Button
- */
- public function setName($name)
- {
- $this->name = $name;
- }
- /**
- * @return bool
- */
- public function getState()
- {
- return $this->state;
- }
- /**
- * @param bool $state
- */
- public function setState($state)
- {
- $this->state = $state;
- }
- /**
- * @return mixed
- */
- public function getLine()
- {
- return $this->line;
- }
- /**
- * @param mixed $line
- */
- public function setLine($line)
- {
- $this->line = $line;
- }
- /**
- * @return mixed
- */
- public function getAssignmentGroups()
- {
- return $this->assignmentGroups;
- }
- /**
- * @return bool
- */
- public function isReported()
- {
- return $this->isReported;
- }
- /**
- * @param bool $isReported
- */
- public function setIsReported($isReported)
- {
- $this->isReported = $isReported;
- }
- /**
- * @param mixed $assignmentGroups
- */
- public function setAssignmentGroups($assignmentGroups)
- {
- $this->assignmentGroups = $assignmentGroups;
- }
- /**
- * @return mixed
- */
- public function getHistoryEntries()
- {
- return $this->historyEntries;
- }
- /**
- * @param mixed $historyEntries
- */
- public function setHistoryEntries($historyEntries)
- {
- $this->historyEntries = $historyEntries;
- }
- public function addAssignmentGroup(AssignmentGroup $assignmentGroup)
- {
- $this->assignmentGroups->add($assignmentGroup);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement