| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- <?php
- namespace AppBundle\Entity\Organization;
- use AppBundle\Annotation\DefaultField;
- use AppBundle\Entity\Core\File;
- use AppBundle\Entity\Core\Tagg;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- use AppBundle\Annotation\ExportSplitFields;
- /**
- * Types d'activités proposées par une structure
- *
- * @Iri("http://schema.org/Activity")
- */
- #[ORM\Entity]
- class Activity
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['activity', 'activity_reference', 'access_details_organizationfunction', 'network_list', 'organization_cotisation_steps'])]
- private $id;
- /**
- * @var string A short description of the item.
- *
- * @Iri("https://schema.org/description")
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['activity'])]
- private $description;
- /**
- * @var File An image of the item. This can be a [URL](http://schema.org/URL) or a fully described [ImageObject](http://schema.org/ImageObject).
- * @Iri("https://schema.org/logo")
- */
- #[Assert\Valid]
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\File', cascade: ['persist'], inversedBy: 'activityLogos')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- #[Groups(['activity'])]
- private $logo;
- /**
- * @var File An image of the item. This can be a [URL](http://schema.org/URL) or a fully described [ImageObject](http://schema.org/ImageObject).
- * @Iri("https://schema.org/logo")
- */
- #[Assert\Valid]
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\File', cascade: ['persist'], inversedBy: 'activityImages')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- #[Groups(['activity'])]
- private $imageActivity;
- /**
- * @var string The name of the item.
- *
- * @Iri("https://schema.org/name")
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['activity', 'activity_reference', 'access_detail_personactivity', 'student_list_personactivity', 'adherent_list_personactivity', 'accesses_list_personactivity', 'rule_personactivityactive', 'accesses_rules_personactivityactive', 'othercontact_list_personactivity', 'access_details_personactivity', 'ca_list_personactivity', 'board_list_personactivity', 'presence_attendance_eventuser', 'adherent_contact_personactivity', 'network_list_activities', 'invitations_list_guest', 'organization_cotisation_steps_activities'])]
- private $name;
- /**
- *
- * @var ActivityType
- */
- #[ORM\ManyToOne(targetEntity: '\AppBundle\Entity\Organization\ActivityType')]
- #[Groups(['activity', 'access_detail_personactivity', 'network_list_activities', 'activity_reference', 'organization_cotisation_steps_activities'])]
- private $activityType;
- /**
- * @var Organization
- *
- * @DefaultField
- */
- #[ORM\ManyToOne(targetEntity: 'Organization', inversedBy: 'activities')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['activity'])]
- private $organization;
- /**
- * @var ArrayCollection<Categories>
- */
- #[Assert\Valid]
- #[ORM\ManyToMany(targetEntity: '\AppBundle\Entity\Core\Categories', cascade: ['persist'])]
- #[Groups(['activity_categories'])]
- private $categories;
- /**
- * @var ArrayCollection<PersonActivity>
- */
- #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Person\PersonActivity', mappedBy: 'activity')]
- #[Groups(['organization_access'])]
- private $personActivities;
- /**
- * @var ArrayCollection<Tagg>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'activities')]
- #[Assert\Valid]
- #[ORM\JoinTable(name: 'tag_activity', joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'activity_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- #[Groups(['activity_tags', 'manage_tags'])]
- private $tags;
- /**
- * @var string
- * @ExportSplitFields({"name","activityType.subFamillyType"})
- */
- #[Groups(['network_list_activities'])]
- private $fullLabelTemplate;
- public function __construct() {
- $this->categories = new ArrayCollection();
- $this->personActivities = new ArrayCollection();
- $this->tags = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Sets description.
- *
- * @param string $description
- *
- * @return $this
- */
- public function setDescription($description)
- {
- $this->description = $description;
- return $this;
- }
- /**
- * Gets description.
- *
- * @return string
- */
- public function getDescription()
- {
- return $this->description;
- }
- /**
- * Sets name.
- *
- * @param string $name
- *
- * @return $this
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * Gets name.
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Sets organization.
- *
- * @param Organization $organization
- *
- * @return $this
- */
- public function setOrganization(Organization $organization)
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * Gets organization.
- *
- * @return Organization
- */
- public function getOrganization()
- {
- return $this->organization;
- }
- /**
- * Add category
- *
- * @param \AppBundle\Entity\Core\Categories $category
- *
- * @return Activity
- */
- public function addCategory(\AppBundle\Entity\Core\Categories $category)
- {
- $this->categories[] = $category;
- return $this;
- }
- /**
- * Remove category
- *
- * @param \AppBundle\Entity\Core\Categories $category
- */
- public function removeCategory(\AppBundle\Entity\Core\Categories $category)
- {
- $this->categories->removeElement($category);
- }
- /**
- * Get categories
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getCategories()
- {
- return $this->categories;
- }
- /**
- * Set logo
- *
- * @param \AppBundle\Entity\Core\File $logo
- *
- * @return Activity
- */
- public function setLogo(\AppBundle\Entity\Core\File $logo = null)
- {
- $this->logo = $logo;
- return $this;
- }
- /**
- * Get logo
- *
- * @return \AppBundle\Entity\Core\File
- */
- public function getLogo()
- {
- return $this->logo;
- }
- /**
- * Set imageActivity
- *
- * @param \AppBundle\Entity\Core\File $imageActivity
- *
- * @return Activity
- */
- public function setImageActivity(\AppBundle\Entity\Core\File $imageActivity = null)
- {
- $this->imageActivity = $imageActivity;
- return $this;
- }
- /**
- * Get imageActivity
- *
- * @return \AppBundle\Entity\Core\File
- */
- public function getImageActivity()
- {
- return $this->imageActivity;
- }
- /**
- * Set activityType
- *
- * @param \AppBundle\Entity\Organization\ActivityType $activityType
- *
- * @return Activity
- */
- public function setActivityType(\AppBundle\Entity\Organization\ActivityType $activityType = null)
- {
- $this->activityType = $activityType;
- return $this;
- }
- /**
- * Get activityType
- *
- * @return \AppBundle\Entity\Organization\ActivityType
- */
- public function getActivityType()
- {
- return $this->activityType;
- }
- /**
- * Add personActivity
- *
- * @param \AppBundle\Entity\Person\PersonActivity $personActivity
- *
- * @return Activity
- */
- public function addPersonActivity(\AppBundle\Entity\Person\PersonActivity $personActivity)
- {
- $this->personActivities[] = $personActivity;
- return $this;
- }
- /**
- * Remove personActivity
- *
- * @param \AppBundle\Entity\Person\PersonActivity $personActivity
- */
- public function removePersonActivity(\AppBundle\Entity\Person\PersonActivity $personActivity)
- {
- $this->personActivities->removeElement($personActivity);
- }
- /**
- * Get personActivities
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getPersonActivities()
- {
- return $this->personActivities;
- }
- /**
- * @return array
- */
- public function getFullLabelTemplate()
- {
- return array($this->getName(), array("value" => $this->getActivityType() ? $this->getActivityType()->getSubFamillyType() : null, "translate" => true));
- }
- /**
- * Add tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- *
- * @return Activity
- */
- public function addTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags[] = $tag;
- return $this;
- }
- /**
- * Remove tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- */
- public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags->removeElement($tag);
- }
- /**
- * Get tags
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getTags()
- {
- return $this->tags;
- }
- }
|