2010-07-04 14:17:15 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Models\Company;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
2012-08-12 06:48:09 +04:00
|
|
|
* @EntityListeners({"CompanyContractListener","CompanyFlexUltraContractListener"})
|
2010-07-04 14:17:15 +04:00
|
|
|
*/
|
|
|
|
class CompanyFlexUltraContract extends CompanyFlexContract
|
|
|
|
{
|
|
|
|
/**
|
2010-09-28 01:22:52 +04:00
|
|
|
* @column(type="integer")
|
2010-07-04 14:17:15 +04:00
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $maxPrice = 0;
|
|
|
|
|
|
|
|
public function calculatePrice()
|
|
|
|
{
|
|
|
|
return max($this->maxPrice, parent::calculatePrice());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMaxPrice()
|
|
|
|
{
|
|
|
|
return $this->maxPrice;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setMaxPrice($maxPrice)
|
|
|
|
{
|
|
|
|
$this->maxPrice = $maxPrice;
|
|
|
|
}
|
2012-08-08 04:31:01 +04:00
|
|
|
|
|
|
|
static public function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
|
|
|
|
{
|
|
|
|
$metadata->mapField(array(
|
|
|
|
'type' => 'integer',
|
|
|
|
'name' => 'maxPrice',
|
|
|
|
'fieldName' => 'maxPrice',
|
|
|
|
));
|
2012-08-12 06:48:09 +04:00
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'CompanyContractListener', 'postPersistHandler');
|
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyContractListener', 'prePersistHandler');
|
2012-08-08 04:31:01 +04:00
|
|
|
|
2012-08-12 06:48:09 +04:00
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::postUpdate, 'CompanyContractListener', 'postUpdateHandler');
|
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::preUpdate, 'CompanyContractListener', 'preUpdateHandler');
|
2012-08-08 04:31:01 +04:00
|
|
|
|
2012-08-12 06:48:09 +04:00
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::postRemove, 'CompanyContractListener', 'postRemoveHandler');
|
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::preRemove, 'CompanyContractListener', 'preRemoveHandler');
|
2012-08-08 04:31:01 +04:00
|
|
|
|
2012-08-12 06:48:09 +04:00
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::preFlush, 'CompanyContractListener', 'preFlushHandler');
|
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::postLoad, 'CompanyContractListener', 'postLoadHandler');
|
2012-08-08 04:31:01 +04:00
|
|
|
|
2012-08-12 06:48:09 +04:00
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyFlexUltraContractListener', 'prePersistHandler1');
|
|
|
|
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyFlexUltraContractListener', 'prePersistHandler2');
|
2012-08-08 04:31:01 +04:00
|
|
|
}
|
2010-07-04 14:17:15 +04:00
|
|
|
}
|