2010-07-04 14:17:15 +04:00
|
|
|
<?php
|
|
|
|
namespace Doctrine\Tests\Models\Company;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
|
|
|
*/
|
|
|
|
class CompanyFlexContract extends CompanyContract
|
|
|
|
{
|
|
|
|
/**
|
2010-09-28 01:22:52 +04:00
|
|
|
* @column(type="integer")
|
2010-07-04 14:17:15 +04:00
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $hoursWorked = 0;
|
|
|
|
|
|
|
|
/**
|
2010-09-28 01:22:52 +04:00
|
|
|
* @column(type="integer")
|
2010-07-04 14:17:15 +04:00
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $pricePerHour = 0;
|
|
|
|
|
2011-12-22 02:56:17 +04:00
|
|
|
/**
|
2011-12-22 03:19:35 +04:00
|
|
|
* @ManyToMany(targetEntity="CompanyManager", inversedBy="managedContracts", fetch="EXTRA_LAZY")
|
2011-12-22 02:56:17 +04:00
|
|
|
* @JoinTable(name="company_contract_managers",
|
|
|
|
* joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")},
|
|
|
|
* inverseJoinColumns={@JoinColumn(name="employee_id", referencedColumnName="id")}
|
|
|
|
* )
|
|
|
|
*/
|
2011-12-22 03:19:35 +04:00
|
|
|
public $managers;
|
2011-12-22 02:56:17 +04:00
|
|
|
|
2010-07-04 14:17:15 +04:00
|
|
|
public function calculatePrice()
|
|
|
|
{
|
|
|
|
return $this->hoursWorked * $this->pricePerHour;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHoursWorked()
|
|
|
|
{
|
|
|
|
return $this->hoursWorked;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setHoursWorked($hoursWorked)
|
|
|
|
{
|
|
|
|
$this->hoursWorked = $hoursWorked;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPricePerHour()
|
|
|
|
{
|
|
|
|
return $this->pricePerHour;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setPricePerHour($pricePerHour)
|
|
|
|
{
|
|
|
|
$this->pricePerHour = $pricePerHour;
|
|
|
|
}
|
2011-12-22 02:56:17 +04:00
|
|
|
public function getManagers()
|
|
|
|
{
|
|
|
|
return $this->managers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addManager(CompanyManager $manager)
|
|
|
|
{
|
|
|
|
$this->managers[] = $manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeManager(CompanyManager $manager)
|
|
|
|
{
|
|
|
|
$this->managers->removeElement($manager);
|
|
|
|
}
|
|
|
|
}
|