Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
59d4e0c8
Commit
59d4e0c8
authored
May 08, 2010
by
Roman S. Borschel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DDC-481] Fixed.
parent
dc3844e1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
38 deletions
+39
-38
ClassMetadataFactory.php
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
+2
-2
ClassMetadataInfo.php
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
+13
-9
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+5
-10
PHPDriver.php
lib/Doctrine/ORM/Mapping/Driver/PHPDriver.php
+0
-2
XmlDriver.php
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+6
-3
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+10
-12
ClassMetadataFactoryTest.php
...s/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php
+3
-0
No files found.
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
View file @
59d4e0c8
...
...
@@ -277,9 +277,9 @@ class ClassMetadataFactory
}
else
{
$this
->
_completeIdGeneratorMapping
(
$class
);
}
if
(
$parent
&&
$parent
->
isInheritanceTypeSingleTable
())
{
$class
->
set
TableName
(
$parent
->
getTableName
()
);
$class
->
set
PrimaryTable
(
$parent
->
table
);
}
$class
->
setParentClasses
(
$visited
);
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
View file @
59d4e0c8
...
...
@@ -903,8 +903,8 @@ class ClassMetadataInfo
/**
* Sets the name of the primary table the class is mapped to.
*
* @param string $tableName
The table name.
* @deprecated
* @param string $tableName The table name.
* @deprecated
Use {@link setPrimaryTable}.
*/
public
function
setTableName
(
$tableName
)
{
...
...
@@ -912,18 +912,22 @@ class ClassMetadataInfo
}
/**
* Sets the primary table definition. The provided array
must have
the
* Sets the primary table definition. The provided array
supports
the
* following structure:
*
* name => <tableName>
*
schema => <schemaName>
*
catalog => <catalogName>
* name => <tableName>
(optional, defaults to class name)
*
indexes => array of indexes (optional)
*
uniqueConstraints => array of constraints (optional)
*
* @param array $
primaryTableDefinition
* @param array $
table
*/
public
function
setPrimaryTable
(
array
$
primaryTableDefinition
)
public
function
setPrimaryTable
(
array
$
table
)
{
$this
->
table
=
$primaryTableDefinition
;
if
(
isset
(
$table
[
'name'
])
&&
$table
[
'name'
][
0
]
==
'`'
)
{
$table
[
'name'
]
=
trim
(
$table
[
'name'
],
'`'
);
$table
[
'quoted'
]
=
true
;
}
$this
->
table
=
$table
;
}
/**
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
59d4e0c8
<?php
/*
* $Id$
*
* 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
...
...
@@ -31,14 +29,11 @@ require __DIR__ . '/DoctrineAnnotations.php';
/**
* The AnnotationDriver reads the mapping metadata from docblock annotations.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
* @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>
* @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>
*/
class
AnnotationDriver
implements
Driver
{
...
...
lib/Doctrine/ORM/Mapping/Driver/PHPDriver.php
View file @
59d4e0c8
<?php
/*
* $Id$
*
* 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
...
...
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
59d4e0c8
...
...
@@ -62,13 +62,16 @@ class XmlDriver extends AbstractFileDriver
}
// Evaluate <entity...> attributes
$table
=
array
();
if
(
isset
(
$xmlRoot
[
'table'
]))
{
$
metadata
->
table
[
'name'
]
=
(
string
)
$xmlRoot
[
'table'
];
$table
[
'name'
]
=
(
string
)
$xmlRoot
[
'table'
];
}
$metadata
->
setPrimaryTable
(
$table
);
/* not implemented specially anyway. use table = schema.table
if (isset($xmlRoot['schema'])) {
$metadata->table['schema'] = (string)$xmlRoot['schema'];
}
}
*/
if
(
isset
(
$xmlRoot
[
'inheritance-type'
]))
{
$inheritanceType
=
(
string
)
$xmlRoot
[
'inheritance-type'
];
...
...
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
59d4e0c8
<?php
/*
* $Id$
*
* 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
...
...
@@ -27,14 +25,11 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo,
/**
* The YamlDriver reads the mapping metadata from yaml schema files.
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
* @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>
* @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>
*/
class
YamlDriver
extends
AbstractFileDriver
{
...
...
@@ -61,13 +56,16 @@ class YamlDriver extends AbstractFileDriver
}
// Evaluate root level properties
$table
=
array
();
if
(
isset
(
$element
[
'table'
]))
{
$
metadata
->
table
[
'name'
]
=
$element
[
'table'
];
$table
[
'name'
]
=
$element
[
'table'
];
}
$metadata
->
setPrimaryTable
(
$table
);
/* not implemented specially anyway. use table = schema.table
if (isset($element['schema'])) {
$metadata->table['schema'] = $element['schema'];
}
}
*/
if
(
isset
(
$element
[
'inheritanceType'
]))
{
$metadata
->
setInheritanceType
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'
.
strtoupper
(
$element
[
'inheritanceType'
])));
...
...
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php
View file @
59d4e0c8
...
...
@@ -26,6 +26,7 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
// Self-made metadata
$cm1
=
new
ClassMetadata
(
'Doctrine\Tests\ORM\Mapping\TestEntity1'
);
$cm1
->
setPrimaryTable
(
array
(
'name'
=>
'`group`'
));
// Add a mapped field
$cm1
->
mapField
(
array
(
'fieldName'
=>
'name'
,
'type'
=>
'varchar'
));
// Add a mapped field
...
...
@@ -54,6 +55,8 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase
// Go
$cm1
=
$cmf
->
getMetadataFor
(
'Doctrine\Tests\ORM\Mapping\TestEntity1'
);
$this
->
assertEquals
(
'group'
,
$cm1
->
table
[
'name'
]);
$this
->
assertTrue
(
$cm1
->
table
[
'quoted'
]);
$this
->
assertEquals
(
array
(),
$cm1
->
parentClasses
);
$this
->
assertTrue
(
$cm1
->
hasField
(
'name'
));
$this
->
assertEquals
(
ClassMetadata
::
GENERATOR_TYPE_SEQUENCE
,
$cm1
->
generatorType
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment