1
0
mirror of synced 2024-12-14 07:06:04 +03:00

php mapping

This commit is contained in:
Fabio B. Silva 2011-09-08 13:17:53 -03:00
parent 6a89de51e5
commit 7f0275155d
8 changed files with 60 additions and 6 deletions

View File

@ -147,10 +147,9 @@ class AnnotationDriver implements Driver
// Evaluate Entity annotation
if (isset($classAnnotations['Doctrine\ORM\Mapping\Entity'])) {
$entityAnnot = $classAnnotations['Doctrine\ORM\Mapping\Entity'];
if($entityAnnot->repositoryClass !== null) {
if ($entityAnnot->repositoryClass !== null) {
$metadata->setCustomRepositoryClass($entityAnnot->repositoryClass);
}
if ($entityAnnot->readOnly) {
$metadata->markReadOnly();
}

View File

@ -28,5 +28,13 @@ class DDC869ChequePayment extends DDC869Payment
/** @column(type="string") */
protected $serialNumber;
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
$metadata->mapField(array(
'fieldName' => 'serialNumber',
'type' => 'string',
));
}
}

View File

@ -28,5 +28,13 @@ class DDC869CreditCardPayment extends DDC869Payment
/** @column(type="string") */
protected $creditCardNumber;
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
$metadata->mapField(array(
'fieldName' => 'creditCardNumber',
'type' => 'string',
));
}
}

View File

@ -35,5 +35,22 @@ class DDC869Payment
/** @column(type="float") */
protected $value;
public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
{
$metadata->mapField(array(
'id' => true,
'fieldName' => 'id',
'type' => 'integer',
'columnName' => 'id',
));
$metadata->mapField(array(
'fieldName' => 'value',
'type' => 'float',
));
$metadata->setCustomRepositoryClass("Doctrine\Tests\Models\DDC869\DDC869PaymentRepository");
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_AUTO);
}
}

View File

@ -297,10 +297,6 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
*/
public function testMappedSuperclassWithRepository()
{
if (strpos(get_class($this), 'PHPMappingDriver') !== false) {
$this->markTestSkipped('PHP Mapping Drivers have no defaults.');
}
$driver = $this->_loadDriver();
$em = $this->_getTestEntityManager();
$factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory();

View File

@ -0,0 +1,5 @@
<?php
$metadata->mapField(array(
'fieldName' => 'serialNumber',
'type' => 'string',
));

View File

@ -0,0 +1,5 @@
<?php
$metadata->mapField(array(
'fieldName' => 'creditCardNumber',
'type' => 'string',
));

View File

@ -0,0 +1,16 @@
<?php
use Doctrine\ORM\Mapping\ClassMetadataInfo;
$metadata->mapField(array(
'id' => true,
'fieldName' => 'id',
'type' => 'integer',
'columnName' => 'id',
));
$metadata->mapField(array(
'fieldName' => 'value',
'type' => 'float',
));
$metadata->setCustomRepositoryClass("Doctrine\Tests\Models\DDC869\DDC869PaymentRepository");
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);