CompanyContract.php 1.9KB

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