2009-02-17 11:01:34 +03:00
|
|
|
<?php
|
2009-05-05 21:20:55 +04:00
|
|
|
/*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* This software consists of voluntary contributions made by many individuals
|
2012-05-26 16:37:00 +04:00
|
|
|
* and is licensed under the MIT license. For more information, see
|
2009-05-05 21:20:55 +04:00
|
|
|
* <http://www.doctrine-project.org>.
|
|
|
|
*/
|
2009-02-17 11:01:34 +03:00
|
|
|
|
|
|
|
namespace Doctrine\ORM\Mapping\Driver;
|
|
|
|
|
2012-12-03 13:36:08 +04:00
|
|
|
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
2012-12-06 00:47:48 +04:00
|
|
|
use Doctrine\ORM\Mapping\Builder\EntityListenerBuilder;
|
2012-12-03 13:36:08 +04:00
|
|
|
use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
|
|
|
|
use Doctrine\ORM\Mapping\MappingException;
|
|
|
|
use Symfony\Component\Yaml\Yaml;
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2008-02-04 00:29:57 +03:00
|
|
|
/**
|
2009-05-05 21:20:55 +04:00
|
|
|
* The YamlDriver reads the mapping metadata from yaml schema files.
|
2008-02-04 00:29:57 +03:00
|
|
|
*
|
2010-05-08 19:01:20 +04:00
|
|
|
* @since 2.0
|
|
|
|
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
|
|
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
|
|
|
* @author Jonathan H. Wage <jonwage@gmail.com>
|
|
|
|
* @author Roman Borschel <roman@code-factory.org>
|
2008-02-04 00:29:57 +03:00
|
|
|
*/
|
2012-01-17 21:33:50 +04:00
|
|
|
class YamlDriver extends FileDriver
|
2008-02-04 00:29:57 +03:00
|
|
|
{
|
2012-01-17 15:32:10 +04:00
|
|
|
const DEFAULT_FILE_EXTENSION = '.dcm.yml';
|
|
|
|
|
2010-01-28 15:46:12 +03:00
|
|
|
/**
|
2012-06-21 17:31:36 +04:00
|
|
|
* {@inheritDoc}
|
2010-01-28 15:46:12 +03:00
|
|
|
*/
|
2012-01-17 15:32:10 +04:00
|
|
|
public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENSION)
|
|
|
|
{
|
|
|
|
parent::__construct($locator, $fileExtension);
|
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2010-01-28 15:46:12 +03:00
|
|
|
/**
|
2012-06-21 17:31:36 +04:00
|
|
|
* {@inheritDoc}
|
2010-01-28 15:46:12 +03:00
|
|
|
*/
|
2012-01-12 05:09:26 +04:00
|
|
|
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
2009-02-17 11:01:34 +03:00
|
|
|
{
|
2012-06-21 17:31:36 +04:00
|
|
|
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */
|
2009-06-06 01:40:47 +04:00
|
|
|
$element = $this->getElement($className);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
if ($element['type'] == 'entity') {
|
2011-09-08 00:27:05 +04:00
|
|
|
if (isset($element['repositoryClass'])) {
|
2011-11-18 21:33:03 +04:00
|
|
|
$metadata->setCustomRepositoryClass($element['repositoryClass']);
|
2011-09-08 00:27:05 +04:00
|
|
|
}
|
2011-03-29 22:17:44 +04:00
|
|
|
if (isset($element['readOnly']) && $element['readOnly'] == true) {
|
|
|
|
$metadata->markReadOnly();
|
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
} else if ($element['type'] == 'mappedSuperclass') {
|
2011-09-08 00:27:05 +04:00
|
|
|
$metadata->setCustomRepositoryClass(
|
|
|
|
isset($element['repositoryClass']) ? $element['repositoryClass'] : null
|
|
|
|
);
|
2009-08-25 01:05:55 +04:00
|
|
|
$metadata->isMappedSuperclass = true;
|
|
|
|
} else {
|
2010-03-26 21:29:20 +03:00
|
|
|
throw MappingException::classIsNotAValidEntityOrMappedSuperClass($className);
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
// Evaluate root level properties
|
2010-05-08 19:01:20 +04:00
|
|
|
$table = array();
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($element['table'])) {
|
2010-05-08 19:01:20 +04:00
|
|
|
$table['name'] = $element['table'];
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2010-05-08 19:01:20 +04:00
|
|
|
$metadata->setPrimaryTable($table);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2011-03-07 00:45:09 +03:00
|
|
|
// Evaluate named queries
|
|
|
|
if (isset($element['namedQueries'])) {
|
|
|
|
foreach ($element['namedQueries'] as $name => $queryMapping) {
|
|
|
|
if (is_string($queryMapping)) {
|
|
|
|
$queryMapping = array('query' => $queryMapping);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! isset($queryMapping['name'])) {
|
|
|
|
$queryMapping['name'] = $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
$metadata->addNamedQuery($queryMapping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-10 06:03:25 +04:00
|
|
|
// Evaluate named native queries
|
|
|
|
if (isset($element['namedNativeQueries'])) {
|
|
|
|
foreach ($element['namedNativeQueries'] as $name => $mappingElement) {
|
|
|
|
if (!isset($mappingElement['name'])) {
|
|
|
|
$mappingElement['name'] = $name;
|
|
|
|
}
|
|
|
|
$metadata->addNamedNativeQuery(array(
|
|
|
|
'name' => $mappingElement['name'],
|
|
|
|
'query' => isset($mappingElement['query']) ? $mappingElement['query'] : null,
|
|
|
|
'resultClass' => isset($mappingElement['resultClass']) ? $mappingElement['resultClass'] : null,
|
|
|
|
'resultSetMapping' => isset($mappingElement['resultSetMapping']) ? $mappingElement['resultSetMapping'] : null,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Evaluate sql result set mappings
|
|
|
|
if (isset($element['sqlResultSetMappings'])) {
|
|
|
|
foreach ($element['sqlResultSetMappings'] as $name => $resultSetMapping) {
|
|
|
|
if (!isset($resultSetMapping['name'])) {
|
|
|
|
$resultSetMapping['name'] = $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
$entities = array();
|
|
|
|
$columns = array();
|
|
|
|
if (isset($resultSetMapping['entityResult'])) {
|
|
|
|
foreach ($resultSetMapping['entityResult'] as $entityResultElement) {
|
|
|
|
$entityResult = array(
|
|
|
|
'fields' => array(),
|
|
|
|
'entityClass' => isset($entityResultElement['entityClass']) ? $entityResultElement['entityClass'] : null,
|
|
|
|
'discriminatorColumn' => isset($entityResultElement['discriminatorColumn']) ? $entityResultElement['discriminatorColumn'] : null,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (isset($entityResultElement['fieldResult'])) {
|
|
|
|
foreach ($entityResultElement['fieldResult'] as $fieldResultElement) {
|
|
|
|
$entityResult['fields'][] = array(
|
|
|
|
'name' => isset($fieldResultElement['name']) ? $fieldResultElement['name'] : null,
|
|
|
|
'column' => isset($fieldResultElement['column']) ? $fieldResultElement['column'] : null,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$entities[] = $entityResult;
|
|
|
|
}
|
|
|
|
}
|
2012-06-09 17:17:45 +04:00
|
|
|
|
2012-03-10 06:03:25 +04:00
|
|
|
|
|
|
|
if (isset($resultSetMapping['columnResult'])) {
|
|
|
|
foreach ($resultSetMapping['columnResult'] as $columnResultAnnot) {
|
|
|
|
$columns[] = array(
|
|
|
|
'name' => isset($columnResultAnnot['name']) ? $columnResultAnnot['name'] : null,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$metadata->addSqlResultSetMapping(array(
|
|
|
|
'name' => $resultSetMapping['name'],
|
|
|
|
'entities' => $entities,
|
|
|
|
'columns' => $columns
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-08 19:01:20 +04:00
|
|
|
/* not implemented specially anyway. use table = schema.table
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($element['schema'])) {
|
2010-03-29 17:20:41 +04:00
|
|
|
$metadata->table['schema'] = $element['schema'];
|
2010-05-08 19:01:20 +04:00
|
|
|
}*/
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($element['inheritanceType'])) {
|
2009-09-30 08:35:43 +04:00
|
|
|
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . strtoupper($element['inheritanceType'])));
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2010-08-08 14:29:14 +04:00
|
|
|
if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
|
|
|
|
// Evaluate discriminatorColumn
|
|
|
|
if (isset($element['discriminatorColumn'])) {
|
|
|
|
$discrColumn = $element['discriminatorColumn'];
|
|
|
|
$metadata->setDiscriminatorColumn(array(
|
2012-02-14 05:22:49 +04:00
|
|
|
'name' => isset($discrColumn['name']) ? (string)$discrColumn['name'] : null,
|
|
|
|
'type' => isset($discrColumn['type']) ? (string)$discrColumn['type'] : null,
|
|
|
|
'length' => isset($discrColumn['length']) ? (string)$discrColumn['length'] : null,
|
|
|
|
'columnDefinition' => isset($discrColumn['columnDefinition']) ? (string)$discrColumn['columnDefinition'] : null
|
2010-08-08 14:29:14 +04:00
|
|
|
));
|
2010-09-24 01:10:31 +04:00
|
|
|
} else {
|
|
|
|
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
|
2010-08-08 14:29:14 +04:00
|
|
|
}
|
2009-08-24 22:33:59 +04:00
|
|
|
|
2010-08-08 14:29:14 +04:00
|
|
|
// Evaluate discriminatorMap
|
|
|
|
if (isset($element['discriminatorMap'])) {
|
|
|
|
$metadata->setDiscriminatorMap($element['discriminatorMap']);
|
|
|
|
}
|
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
|
|
|
|
2010-08-08 14:29:14 +04:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
// Evaluate changeTrackingPolicy
|
|
|
|
if (isset($element['changeTrackingPolicy'])) {
|
2009-09-13 03:17:49 +04:00
|
|
|
$metadata->setChangeTrackingPolicy(constant('Doctrine\ORM\Mapping\ClassMetadata::CHANGETRACKING_'
|
2009-09-30 08:35:43 +04:00
|
|
|
. strtoupper($element['changeTrackingPolicy'])));
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Evaluate indexes
|
|
|
|
if (isset($element['indexes'])) {
|
2009-10-07 02:38:34 +04:00
|
|
|
foreach ($element['indexes'] as $name => $index) {
|
|
|
|
if ( ! isset($index['name'])) {
|
|
|
|
$index['name'] = $name;
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-10-07 02:38:34 +04:00
|
|
|
if (is_string($index['columns'])) {
|
|
|
|
$columns = explode(',', $index['columns']);
|
2012-10-20 07:28:38 +04:00
|
|
|
$columns = array_map('trim', $columns);
|
2009-10-07 02:38:34 +04:00
|
|
|
} else {
|
|
|
|
$columns = $index['columns'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2010-03-29 17:20:41 +04:00
|
|
|
$metadata->table['indexes'][$index['name']] = array(
|
2009-10-07 02:38:34 +04:00
|
|
|
'columns' => $columns
|
2009-09-04 22:35:40 +04:00
|
|
|
);
|
2009-08-24 22:33:59 +04:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-08-24 22:33:59 +04:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
// Evaluate uniqueConstraints
|
|
|
|
if (isset($element['uniqueConstraints'])) {
|
2010-01-06 16:23:56 +03:00
|
|
|
foreach ($element['uniqueConstraints'] as $name => $unique) {
|
|
|
|
if ( ! isset($unique['name'])) {
|
|
|
|
$unique['name'] = $name;
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2010-01-06 16:23:56 +03:00
|
|
|
if (is_string($unique['columns'])) {
|
2009-10-07 02:38:34 +04:00
|
|
|
$columns = explode(',', $unique['columns']);
|
2012-10-20 07:28:38 +04:00
|
|
|
$columns = array_map('trim', $columns);
|
2009-10-07 02:38:34 +04:00
|
|
|
} else {
|
|
|
|
$columns = $unique['columns'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2010-03-29 17:20:41 +04:00
|
|
|
$metadata->table['uniqueConstraints'][$unique['name']] = array(
|
2010-01-06 16:23:56 +03:00
|
|
|
'columns' => $columns
|
|
|
|
);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2012-01-26 17:36:56 +04:00
|
|
|
if (isset($element['options'])) {
|
|
|
|
$metadata->table['options'] = $element['options'];
|
|
|
|
}
|
|
|
|
|
2011-01-01 23:47:04 +03:00
|
|
|
$associationIds = array();
|
2009-10-04 23:35:47 +04:00
|
|
|
if (isset($element['id'])) {
|
|
|
|
// Evaluate identifier settings
|
|
|
|
foreach ($element['id'] as $name => $idElement) {
|
2011-01-01 23:47:04 +03:00
|
|
|
if (isset($idElement['associationKey']) && $idElement['associationKey'] == true) {
|
|
|
|
$associationIds[$name] = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-04 23:35:47 +04:00
|
|
|
$mapping = array(
|
|
|
|
'id' => true,
|
2011-11-14 19:15:43 +04:00
|
|
|
'fieldName' => $name
|
2009-10-04 23:35:47 +04:00
|
|
|
);
|
2011-11-18 21:33:03 +04:00
|
|
|
|
2011-11-14 19:15:43 +04:00
|
|
|
if (isset($idElement['type'])) {
|
|
|
|
$mapping['type'] = $idElement['type'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-10-04 23:35:47 +04:00
|
|
|
if (isset($idElement['column'])) {
|
|
|
|
$mapping['columnName'] = $idElement['column'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2010-06-22 22:24:05 +04:00
|
|
|
if (isset($idElement['length'])) {
|
|
|
|
$mapping['length'] = $idElement['length'];
|
|
|
|
}
|
|
|
|
|
2011-12-05 23:35:49 +04:00
|
|
|
if (isset($idElement['columnDefinition'])) {
|
|
|
|
$mapping['columnDefinition'] = $idElement['columnDefinition'];
|
|
|
|
}
|
2010-06-22 22:24:05 +04:00
|
|
|
|
2013-09-08 12:37:13 +04:00
|
|
|
if (isset($idElement['options'])) {
|
|
|
|
$mapping['options'] = $idElement['options'];
|
|
|
|
}
|
|
|
|
|
2009-10-04 23:35:47 +04:00
|
|
|
$metadata->mapField($mapping);
|
|
|
|
|
|
|
|
if (isset($idElement['generator'])) {
|
|
|
|
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
|
|
|
|
. strtoupper($idElement['generator']['strategy'])));
|
|
|
|
}
|
2010-05-01 05:28:18 +04:00
|
|
|
// Check for SequenceGenerator/TableGenerator definition
|
|
|
|
if (isset($idElement['sequenceGenerator'])) {
|
|
|
|
$metadata->setSequenceGeneratorDefinition($idElement['sequenceGenerator']);
|
2011-11-28 23:01:55 +04:00
|
|
|
} else if (isset($idElement['customIdGenerator'])) {
|
2011-11-30 01:20:00 +04:00
|
|
|
$customGenerator = $idElement['customIdGenerator'];
|
|
|
|
$metadata->setCustomGeneratorDefinition(array(
|
2012-01-08 16:20:35 +04:00
|
|
|
'class' => (string) $customGenerator['class']
|
2011-11-30 01:20:00 +04:00
|
|
|
));
|
2010-05-01 05:28:18 +04:00
|
|
|
} else if (isset($idElement['tableGenerator'])) {
|
|
|
|
throw MappingException::tableIdGeneratorNotImplemented($className);
|
|
|
|
}
|
2009-10-04 23:35:47 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
// Evaluate fields
|
|
|
|
if (isset($element['fields'])) {
|
|
|
|
foreach ($element['fields'] as $name => $fieldMapping) {
|
2011-11-18 21:33:03 +04:00
|
|
|
|
2012-04-14 09:10:44 +04:00
|
|
|
$mapping = $this->columnToArray($name, $fieldMapping);
|
2011-11-18 21:33:03 +04:00
|
|
|
|
2009-10-07 08:07:23 +04:00
|
|
|
if (isset($fieldMapping['id'])) {
|
|
|
|
$mapping['id'] = true;
|
|
|
|
if (isset($fieldMapping['generator']['strategy'])) {
|
|
|
|
$metadata->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
|
|
|
|
. strtoupper($fieldMapping['generator']['strategy'])));
|
|
|
|
}
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-12-16 15:57:53 +04:00
|
|
|
if (isset($mapping['version'])) {
|
|
|
|
$metadata->setVersionMapping($mapping);
|
2013-03-15 02:19:58 +04:00
|
|
|
unset($mapping['version']);
|
2012-12-16 15:57:53 +04:00
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$metadata->mapField($mapping);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2013-05-02 01:10:13 +04:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
// Evaluate oneToOne relationships
|
|
|
|
if (isset($element['oneToOne'])) {
|
|
|
|
foreach ($element['oneToOne'] as $name => $oneToOneElement) {
|
|
|
|
$mapping = array(
|
|
|
|
'fieldName' => $name,
|
|
|
|
'targetEntity' => $oneToOneElement['targetEntity']
|
|
|
|
);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2011-01-01 23:47:04 +03:00
|
|
|
if (isset($associationIds[$mapping['fieldName']])) {
|
|
|
|
$mapping['id'] = true;
|
|
|
|
}
|
|
|
|
|
2009-10-12 16:54:14 +04:00
|
|
|
if (isset($oneToOneElement['fetch'])) {
|
2010-08-09 15:13:21 +04:00
|
|
|
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToOneElement['fetch']);
|
2009-10-12 16:54:14 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($oneToOneElement['mappedBy'])) {
|
|
|
|
$mapping['mappedBy'] = $oneToOneElement['mappedBy'];
|
|
|
|
} else {
|
2010-04-10 02:00:36 +04:00
|
|
|
if (isset($oneToOneElement['inversedBy'])) {
|
|
|
|
$mapping['inversedBy'] = $oneToOneElement['inversedBy'];
|
|
|
|
}
|
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
$joinColumns = array();
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($oneToOneElement['joinColumn'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumns[] = $this->joinColumnToArray($oneToOneElement['joinColumn']);
|
2009-08-25 01:05:55 +04:00
|
|
|
} else if (isset($oneToOneElement['joinColumns'])) {
|
2012-06-21 17:31:36 +04:00
|
|
|
foreach ($oneToOneElement['joinColumns'] as $joinColumnName => $joinColumnElement) {
|
2012-04-14 09:10:44 +04:00
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-06-21 17:31:36 +04:00
|
|
|
$joinColumnElement['name'] = $joinColumnName;
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
$mapping['joinColumns'] = $joinColumns;
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($oneToOneElement['cascade'])) {
|
2010-01-22 18:10:13 +03:00
|
|
|
$mapping['cascade'] = $oneToOneElement['cascade'];
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
|
|
|
|
2011-02-21 06:37:32 +03:00
|
|
|
if (isset($oneToOneElement['orphanRemoval'])) {
|
|
|
|
$mapping['orphanRemoval'] = (bool)$oneToOneElement['orphanRemoval'];
|
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$metadata->mapOneToOne($mapping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Evaluate oneToMany relationships
|
|
|
|
if (isset($element['oneToMany'])) {
|
|
|
|
foreach ($element['oneToMany'] as $name => $oneToManyElement) {
|
|
|
|
$mapping = array(
|
|
|
|
'fieldName' => $name,
|
|
|
|
'targetEntity' => $oneToManyElement['targetEntity'],
|
|
|
|
'mappedBy' => $oneToManyElement['mappedBy']
|
|
|
|
);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-10-12 16:54:14 +04:00
|
|
|
if (isset($oneToManyElement['fetch'])) {
|
2010-08-09 15:13:21 +04:00
|
|
|
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToManyElement['fetch']);
|
2009-10-12 16:54:14 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($oneToManyElement['cascade'])) {
|
2010-01-22 18:10:13 +03:00
|
|
|
$mapping['cascade'] = $oneToManyElement['cascade'];
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2010-02-14 22:38:22 +03:00
|
|
|
|
2011-02-21 06:37:32 +03:00
|
|
|
if (isset($oneToManyElement['orphanRemoval'])) {
|
|
|
|
$mapping['orphanRemoval'] = (bool)$oneToManyElement['orphanRemoval'];
|
|
|
|
}
|
|
|
|
|
2010-02-14 22:38:22 +03:00
|
|
|
if (isset($oneToManyElement['orderBy'])) {
|
|
|
|
$mapping['orderBy'] = $oneToManyElement['orderBy'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2011-02-05 11:31:40 +03:00
|
|
|
if (isset($oneToManyElement['indexBy'])) {
|
|
|
|
$mapping['indexBy'] = $oneToManyElement['indexBy'];
|
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$metadata->mapOneToMany($mapping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Evaluate manyToOne relationships
|
|
|
|
if (isset($element['manyToOne'])) {
|
|
|
|
foreach ($element['manyToOne'] as $name => $manyToOneElement) {
|
|
|
|
$mapping = array(
|
2010-03-15 22:29:07 +03:00
|
|
|
'fieldName' => $name,
|
2009-08-25 01:05:55 +04:00
|
|
|
'targetEntity' => $manyToOneElement['targetEntity']
|
|
|
|
);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2011-01-01 23:47:04 +03:00
|
|
|
if (isset($associationIds[$mapping['fieldName']])) {
|
|
|
|
$mapping['id'] = true;
|
|
|
|
}
|
|
|
|
|
2009-10-12 16:54:14 +04:00
|
|
|
if (isset($manyToOneElement['fetch'])) {
|
2010-08-09 15:13:21 +04:00
|
|
|
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToOneElement['fetch']);
|
2009-10-12 16:54:14 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2010-04-10 02:00:36 +04:00
|
|
|
if (isset($manyToOneElement['inversedBy'])) {
|
|
|
|
$mapping['inversedBy'] = $manyToOneElement['inversedBy'];
|
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$joinColumns = array();
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($manyToOneElement['joinColumn'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumns[] = $this->joinColumnToArray($manyToOneElement['joinColumn']);
|
2009-08-25 01:05:55 +04:00
|
|
|
} else if (isset($manyToOneElement['joinColumns'])) {
|
2012-06-21 17:31:36 +04:00
|
|
|
foreach ($manyToOneElement['joinColumns'] as $joinColumnName => $joinColumnElement) {
|
2012-04-14 09:10:44 +04:00
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-06-21 17:31:36 +04:00
|
|
|
$joinColumnElement['name'] = $joinColumnName;
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$mapping['joinColumns'] = $joinColumns;
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($manyToOneElement['cascade'])) {
|
2010-01-22 18:10:13 +03:00
|
|
|
$mapping['cascade'] = $manyToOneElement['cascade'];
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$metadata->mapManyToOne($mapping);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
// Evaluate manyToMany relationships
|
|
|
|
if (isset($element['manyToMany'])) {
|
|
|
|
foreach ($element['manyToMany'] as $name => $manyToManyElement) {
|
|
|
|
$mapping = array(
|
|
|
|
'fieldName' => $name,
|
|
|
|
'targetEntity' => $manyToManyElement['targetEntity']
|
|
|
|
);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-10-12 16:54:14 +04:00
|
|
|
if (isset($manyToManyElement['fetch'])) {
|
2010-08-09 15:13:21 +04:00
|
|
|
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToManyElement['fetch']);
|
2009-10-12 16:54:14 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($manyToManyElement['mappedBy'])) {
|
|
|
|
$mapping['mappedBy'] = $manyToManyElement['mappedBy'];
|
|
|
|
} else if (isset($manyToManyElement['joinTable'])) {
|
2010-04-10 02:00:36 +04:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$joinTableElement = $manyToManyElement['joinTable'];
|
|
|
|
$joinTable = array(
|
|
|
|
'name' => $joinTableElement['name']
|
2009-06-06 01:40:47 +04:00
|
|
|
);
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($joinTableElement['schema'])) {
|
|
|
|
$joinTable['schema'] = $joinTableElement['schema'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-06-21 17:31:36 +04:00
|
|
|
foreach ($joinTableElement['joinColumns'] as $joinColumnName => $joinColumnElement) {
|
2012-04-14 09:10:44 +04:00
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-06-21 17:31:36 +04:00
|
|
|
$joinColumnElement['name'] = $joinColumnName;
|
2009-02-17 11:01:34 +03:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-06-21 17:31:36 +04:00
|
|
|
foreach ($joinTableElement['inverseJoinColumns'] as $joinColumnName => $joinColumnElement) {
|
2012-04-14 09:10:44 +04:00
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-06-21 17:31:36 +04:00
|
|
|
$joinColumnElement['name'] = $joinColumnName;
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$mapping['joinTable'] = $joinTable;
|
2009-06-06 01:40:47 +04:00
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-04-07 12:42:54 +04:00
|
|
|
if (isset($manyToManyElement['inversedBy'])) {
|
|
|
|
$mapping['inversedBy'] = $manyToManyElement['inversedBy'];
|
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
if (isset($manyToManyElement['cascade'])) {
|
2010-01-22 18:10:13 +03:00
|
|
|
$mapping['cascade'] = $manyToManyElement['cascade'];
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
|
|
|
|
2010-02-14 22:38:22 +03:00
|
|
|
if (isset($manyToManyElement['orderBy'])) {
|
|
|
|
$mapping['orderBy'] = $manyToManyElement['orderBy'];
|
|
|
|
}
|
|
|
|
|
2011-02-05 11:31:40 +03:00
|
|
|
if (isset($manyToManyElement['indexBy'])) {
|
|
|
|
$mapping['indexBy'] = $manyToManyElement['indexBy'];
|
|
|
|
}
|
|
|
|
|
2012-02-20 13:33:16 +04:00
|
|
|
if (isset($manyToManyElement['orphanRemoval'])) {
|
|
|
|
$mapping['orphanRemoval'] = (bool)$manyToManyElement['orphanRemoval'];
|
|
|
|
}
|
|
|
|
|
2009-08-25 01:05:55 +04:00
|
|
|
$metadata->mapManyToMany($mapping);
|
2009-02-17 11:01:34 +03:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-06-06 01:40:47 +04:00
|
|
|
|
2012-02-03 03:11:15 +04:00
|
|
|
// Evaluate associationOverride
|
2012-04-14 09:10:44 +04:00
|
|
|
if (isset($element['associationOverride']) && is_array($element['associationOverride'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
|
2012-04-14 09:10:44 +04:00
|
|
|
foreach ($element['associationOverride'] as $fieldName => $associationOverrideElement) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$override = array();
|
|
|
|
|
2012-02-03 03:11:15 +04:00
|
|
|
// Check for joinColumn
|
2012-04-14 09:10:44 +04:00
|
|
|
if (isset($associationOverrideElement['joinColumn'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumns = array();
|
2012-04-14 09:10:44 +04:00
|
|
|
foreach ($associationOverrideElement['joinColumn'] as $name => $joinColumnElement) {
|
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumnElement['name'] = $name;
|
|
|
|
}
|
|
|
|
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
|
|
|
|
}
|
|
|
|
$override['joinColumns'] = $joinColumns;
|
|
|
|
}
|
|
|
|
|
2012-02-03 03:11:15 +04:00
|
|
|
// Check for joinTable
|
2012-04-14 09:10:44 +04:00
|
|
|
if (isset($associationOverrideElement['joinTable'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
|
2012-04-14 09:10:44 +04:00
|
|
|
$joinTableElement = $associationOverrideElement['joinTable'];
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinTable = array(
|
|
|
|
'name' => $joinTableElement['name']
|
|
|
|
);
|
|
|
|
|
|
|
|
if (isset($joinTableElement['schema'])) {
|
|
|
|
$joinTable['schema'] = $joinTableElement['schema'];
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($joinTableElement['joinColumns'] as $name => $joinColumnElement) {
|
2012-04-14 09:10:44 +04:00
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumnElement['name'] = $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($joinTableElement['inverseJoinColumns'] as $name => $joinColumnElement) {
|
2012-04-14 09:10:44 +04:00
|
|
|
if ( ! isset($joinColumnElement['name'])) {
|
2012-02-02 06:57:39 +04:00
|
|
|
$joinColumnElement['name'] = $name;
|
|
|
|
}
|
|
|
|
|
|
|
|
$joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumnElement);
|
|
|
|
}
|
|
|
|
|
|
|
|
$override['joinTable'] = $joinTable;
|
|
|
|
}
|
|
|
|
|
|
|
|
$metadata->setAssociationOverride($fieldName, $override);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-14 09:10:44 +04:00
|
|
|
// Evaluate associationOverride
|
|
|
|
if (isset($element['attributeOverride']) && is_array($element['attributeOverride'])) {
|
|
|
|
|
|
|
|
foreach ($element['attributeOverride'] as $fieldName => $attributeOverrideElement) {
|
|
|
|
$mapping = $this->columnToArray($fieldName, $attributeOverrideElement);
|
|
|
|
$metadata->setAttributeOverride($fieldName, $mapping);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 13:14:08 +04:00
|
|
|
// Evaluate lifeCycleCallbacks
|
|
|
|
if (isset($element['lifecycleCallbacks'])) {
|
2010-03-15 22:29:07 +03:00
|
|
|
foreach ($element['lifecycleCallbacks'] as $type => $methods) {
|
|
|
|
foreach ($methods as $method) {
|
2010-04-10 02:00:36 +04:00
|
|
|
$metadata->addLifecycleCallback($method, constant('Doctrine\ORM\Events::' . $type));
|
2010-03-15 22:29:07 +03:00
|
|
|
}
|
2009-08-25 01:05:55 +04:00
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
}
|
2012-08-05 23:50:56 +04:00
|
|
|
|
|
|
|
// Evaluate entityListeners
|
|
|
|
if (isset($element['entityListeners'])) {
|
2012-10-07 01:13:51 +04:00
|
|
|
foreach ($element['entityListeners'] as $className => $entityListener) {
|
2012-12-06 00:47:48 +04:00
|
|
|
// Evaluate the listener using naming convention.
|
|
|
|
if (empty($entityListener)) {
|
|
|
|
EntityListenerBuilder::bindEntityListener($metadata, $className);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-08-05 23:50:56 +04:00
|
|
|
foreach ($entityListener as $eventName => $callbackElement){
|
|
|
|
foreach ($callbackElement as $methodName){
|
2012-10-07 01:13:51 +04:00
|
|
|
$metadata->addEntityListener($eventName, $className, $methodName);
|
2012-08-05 23:50:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-17 11:01:34 +03:00
|
|
|
}
|
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
/**
|
|
|
|
* Constructs a joinColumn mapping array based on the information
|
2009-06-06 01:58:05 +04:00
|
|
|
* found in the given join column element.
|
2010-03-15 22:29:07 +03:00
|
|
|
*
|
2012-12-03 13:36:08 +04:00
|
|
|
* @param array $joinColumnElement The array join column element.
|
|
|
|
*
|
2009-06-06 01:40:47 +04:00
|
|
|
* @return array The mapping array.
|
|
|
|
*/
|
2012-02-02 06:57:39 +04:00
|
|
|
private function joinColumnToArray($joinColumnElement)
|
2008-02-04 00:29:57 +03:00
|
|
|
{
|
2012-03-10 06:03:25 +04:00
|
|
|
$joinColumn = array();
|
|
|
|
if (isset($joinColumnElement['referencedColumnName'])) {
|
|
|
|
$joinColumn['referencedColumnName'] = (string) $joinColumnElement['referencedColumnName'];
|
|
|
|
}
|
2012-06-09 17:17:45 +04:00
|
|
|
|
2012-03-10 06:03:25 +04:00
|
|
|
if (isset($joinColumnElement['name'])) {
|
|
|
|
$joinColumn['name'] = (string) $joinColumnElement['name'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
|
|
|
if (isset($joinColumnElement['fieldName'])) {
|
|
|
|
$joinColumn['fieldName'] = (string) $joinColumnElement['fieldName'];
|
|
|
|
}
|
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
if (isset($joinColumnElement['unique'])) {
|
|
|
|
$joinColumn['unique'] = (bool) $joinColumnElement['unique'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
if (isset($joinColumnElement['nullable'])) {
|
|
|
|
$joinColumn['nullable'] = (bool) $joinColumnElement['nullable'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
if (isset($joinColumnElement['onDelete'])) {
|
|
|
|
$joinColumn['onDelete'] = $joinColumnElement['onDelete'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2010-02-02 00:48:27 +03:00
|
|
|
if (isset($joinColumnElement['columnDefinition'])) {
|
|
|
|
$joinColumn['columnDefinition'] = $joinColumnElement['columnDefinition'];
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
return $joinColumn;
|
|
|
|
}
|
2010-03-15 22:29:07 +03:00
|
|
|
|
2012-04-14 09:10:44 +04:00
|
|
|
/**
|
2012-12-03 13:36:08 +04:00
|
|
|
* Parses the given column as array.
|
|
|
|
*
|
|
|
|
* @param string $fieldName
|
|
|
|
* @param array $column
|
2012-04-14 09:10:44 +04:00
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
private function columnToArray($fieldName, $column)
|
|
|
|
{
|
|
|
|
$mapping = array(
|
|
|
|
'fieldName' => $fieldName
|
|
|
|
);
|
|
|
|
|
|
|
|
if (isset($column['type'])) {
|
|
|
|
$params = explode('(', $column['type']);
|
|
|
|
$column['type'] = $params[0];
|
|
|
|
$mapping['type'] = $column['type'];
|
|
|
|
|
|
|
|
if (isset($params[1])) {
|
2012-10-20 07:28:38 +04:00
|
|
|
$column['length'] = (integer) substr($params[1], 0, strlen($params[1]) - 1);
|
2012-04-14 09:10:44 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['column'])) {
|
|
|
|
$mapping['columnName'] = $column['column'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['length'])) {
|
|
|
|
$mapping['length'] = $column['length'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['precision'])) {
|
|
|
|
$mapping['precision'] = $column['precision'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['scale'])) {
|
|
|
|
$mapping['scale'] = $column['scale'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['unique'])) {
|
|
|
|
$mapping['unique'] = (bool)$column['unique'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['options'])) {
|
|
|
|
$mapping['options'] = $column['options'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['nullable'])) {
|
|
|
|
$mapping['nullable'] = $column['nullable'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['version']) && $column['version']) {
|
2012-06-09 17:17:45 +04:00
|
|
|
$mapping['version'] = $column['version'];
|
2012-04-14 09:10:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($column['columnDefinition'])) {
|
|
|
|
$mapping['columnDefinition'] = $column['columnDefinition'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $mapping;
|
|
|
|
}
|
|
|
|
|
2009-06-06 01:40:47 +04:00
|
|
|
/**
|
2012-06-21 17:31:36 +04:00
|
|
|
* {@inheritDoc}
|
2009-06-06 01:40:47 +04:00
|
|
|
*/
|
2012-01-17 15:32:10 +04:00
|
|
|
protected function loadMappingFile($file)
|
2009-06-06 01:40:47 +04:00
|
|
|
{
|
2012-01-17 15:32:10 +04:00
|
|
|
return Yaml::parse($file);
|
2009-02-17 11:01:34 +03:00
|
|
|
}
|
2010-06-22 22:24:05 +04:00
|
|
|
}
|