| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <?php
- namespace AppBundle\Entity\AccessAndFunction;
- use AppBundle\Annotation\DefaultField;
- use AppBundle\Annotation\ExportSplitFields;
- use AppBundle\Entity\Traits\ActivityPeriodTrait;
- 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\Entity\Organization\Activity;
- /**
- * Fonction d'un Access dans une Organization sur une période donnée
- *
- * @Iri("http://schema.org/OrganizationFunction")
- */
- #[ORM\Entity(repositoryClass: 'AppBundle\Entity\AccessAndFunction\Repository\OrganizationFunctionRepository')]
- class OrganizationFunction
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- use ActivityPeriodTrait;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['organizationfunction', 'access_details', 'adherent_list', 'personnels_list', 'ca_list', 'accesses_list', 'othercontact_list', 'student_registration', 'student_registration_guardians', 'student_registration_accessfamily', 'board_list', 'licence_cmf', 'organization_function_edit', 'access_informations_edit', 'adherent_contact', 'cotisation_responsibles_accesses', 'view_from_manager_create', 'networkmanagers_list', 'online_registration_access_details', 'accesscmfnetwork'])]
- private $id;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'Access', inversedBy: 'organizationFunction')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['organizationfunction', 'organization_function_edit'])]
- private $access;
- /**
- * @var FunctionType
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\FunctionType')]
- #[ORM\JoinColumn(nullable: false)]
- #[Assert\NotNull]
- #[Groups(['organizationfunction', 'access_details_organizationfunction', 'adherent_list_organizationfunction', 'personnels_list_organizationfunction', 'othercontact_list_organizationfunction', 'ca_list_organizationfunction', 'accesses_list_organizationfunction', 'student_registration_organizationfunction', 'student_registration_guardians', 'student_registration_accessfamily', 'board_list_organizationfunction', 'licence_cmf_organizationfunction', 'access_informations_edit_organizationfunction', 'adherent_contact_organizationfunction', 'organization_function_edit', 'cotisation_responsibles_accesses_organizationfunction', 'view_from_manager_create_organizationfunction', 'networkmanagers_list_organizationfunction', 'online_registration_access_details_organizationfunction', 'accesscmfnetwork_organizationfunction'])]
- private $functionType;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['organizationfunction', 'access_details_organizationfunction', 'organization_function_edit', 'othercontact_list_organizationfunction', 'networkmanagers_list_organizationfunction', 'personnels_list_organizationfunction'])]
- private $functionComplement;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['\AppBundle\Enum\AccessAndFunction\DeparturesCauseEnum', 'toArray'])]
- #[Groups(['organizationfunction', 'accesses_list_organizationfunction', 'adherent_list_organizationfunction', 'personnels_list_organizationfunction', 'ca_list_organizationfunction', 'board_list_organizationfunction', 'access_details_organizationfunction', 'organization_function_edit', 'view_from_manager_create_organizationfunction'])]
- private $departureCause;
- /**
- * @var Activity
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Activity')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- #[Groups(['organizationfunction', 'access_details_organizationfunction', 'organization_function_edit'])]
- private $activity;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => true])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['organizationfunction', 'organization_function_edit'])]
- private $isMemberSection = true;
- /**
- * @var string
- * @ExportSplitFields({"functionType.mission","startDate","endDate"})
- */
- #[Groups(['template'])]
- private $fullLabelTemplate;
- /**
- * 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 functionType.
- *
- * @param string $functionType
- *
- * @return $this
- */
- public function setFunctionType($functionType)
- {
- $this->functionType = $functionType;
- return $this;
- }
- /**
- * Get functionType
- *
- * @return \AppBundle\Entity\AccessAndFunction\FunctionType
- */
- public function getFunctionType()
- {
- return $this->functionType;
- }
- /**
- * Sets functionComplement.
- *
- * @param string $functionComplement
- *
- * @return $this
- */
- public function setFunctionComplement($functionComplement)
- {
- $this->functionComplement = $functionComplement;
- return $this;
- }
- /**
- * Gets functionComplement.
- *
- * @return string
- */
- public function getFunctionComplement()
- {
- return $this->functionComplement;
- }
- /**
- * Sets departureCause.
- *
- * @param string $departureCause
- *
- * @return $this
- */
- public function setDepartureCause($departureCause)
- {
- $this->departureCause = $departureCause;
- return $this;
- }
- /**
- * Gets departureCause.
- *
- * @return string
- */
- public function getDepartureCause()
- {
- return $this->departureCause;
- }
- /**
- * Sets activity.
- *
- * @param Activity $activity
- *
- * @return $this
- */
- public function setActivity(Activity $activity = null)
- {
- $this->activity = $activity;
- return $this;
- }
- /**
- * Gets activity.
- *
- * @return Activity
- */
- public function getActivity()
- {
- return $this->activity;
- }
- /**
- * Set access
- *
- * @param \AppBundle\Entity\AccessAndFunction\Access $access
- *
- * @return OrganizationFunction
- */
- public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
- {
- $this->access = $access;
- return $this;
- }
- /**
- * Get access
- *
- * @return \AppBundle\Entity\AccessAndFunction\Access
- */
- public function getAccess()
- {
- return $this->access;
- }
- /**
- * Sets isMemberSection.
- *
- * @param bool $isMemberSection
- *
- * @return $this
- */
- public function setIsPhysical($isMemberSection)
- {
- $this->isMemberSection = $isMemberSection;
- return $this;
- }
- /**
- * Gets isMemberSection.
- *
- * @return bool
- */
- public function getIsPhysical()
- {
- return $this->isMemberSection;
- }
- /**
- * Set isMemberSection
- *
- * @param boolean $isMemberSection
- *
- * @return OrganizationFunction
- */
- public function setIsMemberSection($isMemberSection)
- {
- $this->isMemberSection = $isMemberSection;
- return $this;
- }
- /**
- * Get isMemberSection
- *
- * @return boolean
- */
- public function getIsMemberSection()
- {
- return $this->isMemberSection;
- }
- /**
- * @return array
- * @throws \Exception
- */
- public function getFullLabelTemplate()
- {
- $startDate = new \DateTime($this->getStartDate());
- $fullLabelTemplate = [
- ['value' => $this->getFunctionType()->getMission(), 'translate' => true],
- $startDate->format('d-m-Y')
- ];
- if(!empty($this->getEndDate())){
- $endDate = new \DateTime($this->getEndDate());
- $fullLabelTemplate[] = $endDate->format('d-m-Y');
- }
- return $fullLabelTemplate;
- }
- }
|