EducationalProjectPayer.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\Entity\Billing;
  4. use ApiPlatform\Metadata\Get;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Entity\Access\Access;
  7. use App\Entity\Booking\EducationalProject;
  8. //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table EducationalProjectPayer, et supprimer l'attribut discr.
  12. *
  13. * Classe ... qui ...
  14. */
  15. #[ApiResource(
  16. operations: [
  17. new Get(
  18. security: 'is_granted(\'ROLE_ADMIN\') and object.getEducationalProjectPayer().getOrganization().getId() == user.getOrganization().getId()'
  19. )
  20. ]
  21. )]
  22. //#[Auditable]
  23. #[ORM\Table(name: 'BillingPayer')]
  24. #[ORM\Entity]
  25. class EducationalProjectPayer
  26. {
  27. #[ORM\Column(length: 255, nullable: false)]
  28. private string $discr = 'educationalproject';
  29. #[ORM\Id]
  30. #[ORM\Column]
  31. #[ORM\GeneratedValue]
  32. private ?int $id = null;
  33. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'billingEducationalProjectPayers')]
  34. private Access $educationalProjectPayer;
  35. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'billingReceivers')]
  36. private EducationalProject $educationalProjectReceiver;
  37. public function getId(): ?int
  38. {
  39. return $this->id;
  40. }
  41. public function getEducationalProjectPayer(): ?Access
  42. {
  43. return $this->educationalProjectPayer;
  44. }
  45. public function setEducationalProjectPayer(?Access $educationalProjectPayer): self
  46. {
  47. $this->educationalProjectPayer = $educationalProjectPayer;
  48. return $this;
  49. }
  50. public function getEducationalProjectReceiver(): ?EducationalProject
  51. {
  52. return $this->educationalProjectReceiver;
  53. }
  54. public function setEducationalProjectReceiver(?EducationalProject $educationalProjectReceiver): self
  55. {
  56. $this->educationalProjectReceiver = $educationalProjectReceiver;
  57. return $this;
  58. }
  59. }