| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 | <?php
namespace Doctrine\Tests\Models\Company;
/**
 * @Entity
 * @Table(name="company_contracts")
 * @InheritanceType("SINGLE_TABLE")
 * @DiscriminatorColumn(name="discr", type="string")
 * @DiscriminatorMap({"fix" = "CompanyFixContract", "flexible" = "CompanyFlexContract", "flexultra" = "CompanyFlexUltraContract"})
 */
abstract class CompanyContract
{
    /**
     * @Id @column(type="integer") @GeneratedValue
     */
    private $id;
    /**
     * @ManyToOne(targetEntity="CompanyEmployee")
     */
    private $salesPerson;
    /**
     * @Column(type="boolean")
     * @var bool
     */
    private $completed = false;
    /**
     * @ManyToMany(targetEntity="CompanyEmployee")
     * @JoinTable(name="company_contract_employees",
     *    joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")},
     *    inverseJoinColumns={@JoinColumn(name="employee_id", referencedColumnName="id")}
     * )
     */
    private $engineers;
    public function __construct()
    {
        $this->engineers = new \Doctrine\Common\Collections\ArrayCollection;
    }
    public function getId()
    {
        return $this->id;
    }
    public function markCompleted()
    {
        $this->completed = true;
    }
    public function isCompleted()
    {
        return $this->completed;
    }
    public function getSalesPerson()
    {
        return $this->salesPerson;
    }
    public function setSalesPerson(CompanyEmployee $salesPerson)
    {
        $this->salesPerson = $salesPerson;
    }
    public function getEngineers()
    {
        return $this->engineers;
    }
    public function addEngineer(CompanyEmployee $engineer)
    {
        $this->engineers[] = $engineer;
    }
    public function removeEngineer(CompanyEmployee $engineer)
    {
        $this->engineers->removeElement($engineer);
    }
    abstract public function calculatePrice();
}
 |