1
0
mirror of synced 2024-12-14 15:16:04 +03:00

php driver

This commit is contained in:
Fabio B. Silva 2012-08-07 21:36:47 -03:00 committed by fabio.silva
parent 415c2a95f2
commit 7021f002f2
5 changed files with 81 additions and 8 deletions

View File

@ -758,10 +758,6 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
*/
public function testEntityListeners()
{
if ($this instanceof PHPMappingDriverTest) {
$this->markTestIncomplete();
}
$em = $this->_getTestEntityManager();
$factory = $this->createClassMetadataFactory($em);
$superClass = $factory->getMetadataFor('Doctrine\Tests\Models\Company\CompanyContract');
@ -816,10 +812,6 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
*/
public function testCallEntityListeners()
{
if ($this instanceof PHPMappingDriverTest) {
$this->markTestIncomplete();
}
$em = $this->_getTestEntityManager();
$factory = $this->createClassMetadataFactory($em);
$flexClass = $factory->getMetadataFor('Doctrine\Tests\Models\Company\CompanyFixContract');

View File

@ -0,0 +1,40 @@
<?php
use Doctrine\ORM\Mapping\ClassMetadataInfo;
$metadata->setInheritanceType(\Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_JOINED);
$metadata->setTableName( 'company_contracts');
$metadata->setDiscriminatorColumn(array(
'name' => 'discr',
'type' => 'string',
));
$metadata->mapField(array(
'id' => true,
'name' => 'id',
'fieldName' => 'id',
));
$metadata->mapField(array(
'type' => 'boolean',
'name' => 'completed',
'fieldName' => 'completed',
));
$metadata->setDiscriminatorMap(array(
"fix" => "CompanyFixContract",
"flexible" => "CompanyFlexContract",
"flexultra" => "CompanyFlexUltraContract"
));
$metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'ContractSubscriber', 'postPersistHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'ContractSubscriber', 'prePersistHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::postUpdate, 'ContractSubscriber', 'postUpdateHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::preUpdate, 'ContractSubscriber', 'preUpdateHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::postRemove, 'ContractSubscriber', 'postRemoveHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::preRemove, 'ContractSubscriber', 'preRemoveHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::preFlush, 'ContractSubscriber', 'preFlushHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::postLoad, 'ContractSubscriber', 'postLoadHandler');

View File

@ -0,0 +1,7 @@
<?php
$metadata->mapField(array(
'type' => 'integer',
'name' => 'fixPrice',
'fieldName' => 'fixPrice',
));

View File

@ -0,0 +1,13 @@
<?php
$metadata->mapField(array(
'type' => 'integer',
'name' => 'hoursWorked',
'fieldName' => 'hoursWorked',
));
$metadata->mapField(array(
'type' => 'integer',
'name' => 'pricePerHour',
'fieldName' => 'pricePerHour',
));

View File

@ -0,0 +1,21 @@
<?php
$metadata->mapField(array(
'type' => 'integer',
'name' => 'maxPrice',
'fieldName' => 'maxPrice',
));
$metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'ContractSubscriber', 'postPersistHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'ContractSubscriber', 'prePersistHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::postUpdate, 'ContractSubscriber', 'postUpdateHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::preUpdate, 'ContractSubscriber', 'preUpdateHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::postRemove, 'ContractSubscriber', 'postRemoveHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::preRemove, 'ContractSubscriber', 'preRemoveHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::preFlush, 'ContractSubscriber', 'preFlushHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::postLoad, 'ContractSubscriber', 'postLoadHandler');
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'FlexUltraContractSubscriber', 'prePersistHandler1');
$metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'FlexUltraContractSubscriber', 'prePersistHandler2');