1
0
mirror of synced 2025-01-19 06:51:40 +03:00

Updating mapping driver interface to comply with Doctrine\Common\Persistence\Mapping\Driver\MappingDriver

This commit is contained in:
Marco Pivetta 2012-01-12 02:09:26 +01:00
parent f20a95fdc0
commit e6a2bae5d7
9 changed files with 21 additions and 44 deletions

View File

@ -22,10 +22,10 @@ namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Cache\ArrayCache, use Doctrine\Common\Cache\ArrayCache,
Doctrine\Common\Annotations\AnnotationReader, Doctrine\Common\Annotations\AnnotationReader,
Doctrine\Common\Annotations\AnnotationRegistry, Doctrine\Common\Annotations\AnnotationRegistry,
Doctrine\ORM\Mapping\ClassMetadataInfo,
Doctrine\ORM\Mapping\MappingException, Doctrine\ORM\Mapping\MappingException,
Doctrine\ORM\Mapping\JoinColumn, Doctrine\ORM\Mapping\JoinColumn,
Doctrine\ORM\Mapping\Column; Doctrine\ORM\Mapping\Column,
Doctrine\Common\Persistence\Mapping\ClassMetadata;
/** /**
* The AnnotationDriver reads the mapping metadata from docblock annotations. * The AnnotationDriver reads the mapping metadata from docblock annotations.
@ -133,7 +133,7 @@ class AnnotationDriver implements Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
$class = $metadata->getReflectionClass(); $class = $metadata->getReflectionClass();
if ( ! $class) { if ( ! $class) {

View File

@ -23,6 +23,7 @@ use Doctrine\Common\Cache\ArrayCache,
Doctrine\Common\Annotations\AnnotationReader, Doctrine\Common\Annotations\AnnotationReader,
Doctrine\DBAL\Schema\AbstractSchemaManager, Doctrine\DBAL\Schema\AbstractSchemaManager,
Doctrine\DBAL\Schema\SchemaException, Doctrine\DBAL\Schema\SchemaException,
Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\ORM\Mapping\ClassMetadataInfo,
Doctrine\ORM\Mapping\MappingException, Doctrine\ORM\Mapping\MappingException,
Doctrine\Common\Util\Inflector; Doctrine\Common\Util\Inflector;
@ -156,7 +157,7 @@ class DatabaseDriver implements Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
$this->reverseEngineerMappingFromDatabase(); $this->reverseEngineerMappingFromDatabase();

View File

@ -19,7 +19,7 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
/** /**
* Contract for metadata drivers. * Contract for metadata drivers.
@ -28,30 +28,6 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo;
* @author Jonathan H. Wage <jonwage@gmail.com> * @author Jonathan H. Wage <jonwage@gmail.com>
* @todo Rename: MetadataDriver or MappingDriver * @todo Rename: MetadataDriver or MappingDriver
*/ */
interface Driver interface Driver extends MappingDriver
{ {
/**
* Loads the metadata for the specified class into the provided container.
*
* @param string $className
* @param ClassMetadataInfo $metadata
*/
function loadMetadataForClass($className, ClassMetadataInfo $metadata);
/**
* Gets the names of all mapped classes known to this driver.
*
* @return array The names of all mapped classes known to this driver.
*/
function getAllClassNames();
/**
* Whether the class with the specified name should have its metadata loaded.
* This is only the case if it is either mapped as an Entity or a
* MappedSuperclass.
*
* @param string $className
* @return boolean
*/
function isTransient($className);
} }

View File

@ -20,7 +20,7 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\ORM\Mapping\Driver\Driver, use Doctrine\ORM\Mapping\Driver\Driver,
Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\MappingException; Doctrine\ORM\Mapping\MappingException;
/** /**
@ -93,9 +93,9 @@ class DriverChain implements Driver
* Loads the metadata for the specified class into the provided container. * Loads the metadata for the specified class into the provided container.
* *
* @param string $className * @param string $className
* @param ClassMetadataInfo $metadata * @param ClassMetadata $metadata
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
foreach ($this->drivers as $namespace => $driver) { foreach ($this->drivers as $namespace => $driver) {
if (strpos($className, $namespace) === 0) { if (strpos($className, $namespace) === 0) {

View File

@ -22,13 +22,13 @@ namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\Common\Cache\ArrayCache, use Doctrine\Common\Cache\ArrayCache,
Doctrine\Common\Annotations\AnnotationReader, Doctrine\Common\Annotations\AnnotationReader,
Doctrine\DBAL\Schema\AbstractSchemaManager, Doctrine\DBAL\Schema\AbstractSchemaManager,
Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\MappingException, Doctrine\ORM\Mapping\MappingException,
Doctrine\Common\Util\Inflector, Doctrine\Common\Util\Inflector,
Doctrine\ORM\Mapping\Driver\AbstractFileDriver; Doctrine\ORM\Mapping\Driver\AbstractFileDriver;
/** /**
* The PHPDriver includes php files which just populate ClassMetadataInfo * The PHPDriver includes php files which just populate ClassMetadata
* instances with plain php code * instances with plain php code
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -52,7 +52,7 @@ class PHPDriver extends AbstractFileDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
$this->_metadata = $metadata; $this->_metadata = $metadata;
$this->_loadMappingFile($this->_findMappingFile($className)); $this->_loadMappingFile($this->_findMappingFile($className));

View File

@ -19,7 +19,7 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\ORM\Mapping\ClassMetadataInfo, use Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\MappingException; Doctrine\ORM\Mapping\MappingException;
/** /**
@ -70,7 +70,7 @@ class StaticPHPDriver implements Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
call_user_func_array(array($className, 'loadMetadata'), array($metadata)); call_user_func_array(array($className, 'loadMetadata'), array($metadata));
} }

View File

@ -20,7 +20,7 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use SimpleXMLElement, use SimpleXMLElement,
Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\MappingException; Doctrine\ORM\Mapping\MappingException;
/** /**
@ -44,7 +44,7 @@ class XmlDriver extends AbstractFileDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
$xmlRoot = $this->getElement($className); $xmlRoot = $this->getElement($className);

View File

@ -19,7 +19,7 @@
namespace Doctrine\ORM\Mapping\Driver; namespace Doctrine\ORM\Mapping\Driver;
use Doctrine\ORM\Mapping\ClassMetadataInfo, use Doctrine\Common\Persistence\Mapping\ClassMetadata,
Doctrine\ORM\Mapping\MappingException; Doctrine\ORM\Mapping\MappingException;
/** /**
@ -41,7 +41,7 @@ class YamlDriver extends AbstractFileDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function loadMetadataForClass($className, ClassMetadataInfo $metadata) public function loadMetadataForClass($className, ClassMetadata $metadata)
{ {
$element = $this->getElement($className); $element = $this->getElement($className);

View File

@ -4,7 +4,7 @@ namespace Doctrine\Tests\Mocks;
class MetadataDriverMock implements \Doctrine\ORM\Mapping\Driver\Driver class MetadataDriverMock implements \Doctrine\ORM\Mapping\Driver\Driver
{ {
public function loadMetadataForClass($className, \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata) public function loadMetadataForClass($className, \Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata)
{ {
return; return;
} }