Permalink
Browse files

php driver

  • Loading branch information...
1 parent 415c2a9 commit 7021f002f22bcfd16a6e67d16662c4501ea6f2ec @FabioBatSilva committed with fabio.silva Aug 8, 2012
View
8 tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
@@ -758,10 +758,6 @@ public function testAttributeOverridesMapping()
*/
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 @@ public function testEntityListeners()
*/
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
40 tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Company.CompanyContract.php
@@ -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
7 tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Company.CompanyFixContract.php
@@ -0,0 +1,7 @@
+<?php
+
+$metadata->mapField(array(
+ 'type' => 'integer',
+ 'name' => 'fixPrice',
+ 'fieldName' => 'fixPrice',
+));
View
13 tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Company.CompanyFlexContract.php
@@ -0,0 +1,13 @@
+<?php
+
+$metadata->mapField(array(
+ 'type' => 'integer',
+ 'name' => 'hoursWorked',
+ 'fieldName' => 'hoursWorked',
+));
+
+$metadata->mapField(array(
+ 'type' => 'integer',
+ 'name' => 'pricePerHour',
+ 'fieldName' => 'pricePerHour',
+));
View
21 ...Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Company.CompanyFlexUltraContract.php
@@ -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');

0 comments on commit 7021f00

Please sign in to comment.