CompanyContract.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace Doctrine\Tests\Models\Company;
  3. /**
  4. * @Entity
  5. * @Table(name="company_contracts")
  6. * @InheritanceType("SINGLE_TABLE")
  7. * @DiscriminatorColumn(name="discr", type="string")
  8. * @DiscriminatorMap({"fix" = "CompanyFixContract", "flexible" = "CompanyFlexContract", "flexultra" = "CompanyFlexUltraContract"})
  9. */
  10. abstract class CompanyContract
  11. {
  12. /**
  13. * @Id @column(type="integer") @GeneratedValue
  14. */
  15. private $id;
  16. /**
  17. * @ManyToOne(targetEntity="CompanyEmployee")
  18. */
  19. private $salesPerson;
  20. /**
  21. * @Column(type="boolean")
  22. * @var bool
  23. */
  24. private $completed = false;
  25. /**
  26. * @ManyToMany(targetEntity="CompanyEmployee")
  27. * @JoinTable(name="company_contract_employees",
  28. * joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")},
  29. * inverseJoinColumns={@JoinColumn(name="employee_id", referencedColumnName="id")}
  30. * )
  31. */
  32. private $engineers;
  33. public function __construct()
  34. {
  35. $this->engineers = new \Doctrine\Common\Collections\ArrayCollection;
  36. }
  37. public function getId()
  38. {
  39. return $this->id;
  40. }
  41. public function markCompleted()
  42. {
  43. $this->completed = true;
  44. }
  45. public function isCompleted()
  46. {
  47. return $this->completed;
  48. }
  49. public function getSalesPerson()
  50. {
  51. return $this->salesPerson;
  52. }
  53. public function setSalesPerson(CompanyEmployee $salesPerson)
  54. {
  55. $this->salesPerson = $salesPerson;
  56. }
  57. public function getEngineers()
  58. {
  59. return $this->engineers;
  60. }
  61. public function addEngineer(CompanyEmployee $engineer)
  62. {
  63. $this->engineers[] = $engineer;
  64. }
  65. public function removeEngineer(CompanyEmployee $engineer)
  66. {
  67. $this->engineers->removeElement($engineer);
  68. }
  69. abstract public function calculatePrice();
  70. }