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
a652bc69
Commit
a652bc69
authored
Jan 27, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] DDC-247 - Fix bug with nullable not working in XML field and join-column properties.
parent
9d7bd733
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
XmlDriver.php
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+7
-3
MappingDriverTest.php
tests/Doctrine/Tests/ORM/Mapping/MappingDriverTest.php
+7
-1
Doctrine.Tests.ORM.Mapping.User.dcm.xml
...s/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
+2
-2
Doctrine.Tests.ORM.Mapping.User.dcm.yml
.../ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
+4
-0
No files found.
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
a652bc69
...
...
@@ -148,12 +148,16 @@ class XmlDriver extends AbstractFileDriver
}
if
(
isset
(
$fieldMapping
[
'unique'
]))
{
$mapping
[
'unique'
]
=
(
bool
)
$fieldMapping
[
'unique'
]
;
$mapping
[
'unique'
]
=
((
string
)
$fieldMapping
[
'unique'
]
==
"false"
)
?
false
:
true
;
}
if
(
isset
(
$fieldMapping
[
'options'
]))
{
$mapping
[
'options'
]
=
(
array
)
$fieldMapping
[
'options'
];
}
if
(
isset
(
$fieldMapping
[
'nullable'
]))
{
$mapping
[
'nullable'
]
=
((
string
)
$fieldMapping
[
'nullable'
]
==
"false"
)
?
false
:
true
;
}
if
(
isset
(
$fieldMapping
[
'version'
])
&&
$fieldMapping
[
'version'
])
{
$metadata
->
setVersionMapping
(
$mapping
);
...
...
@@ -407,11 +411,11 @@ class XmlDriver extends AbstractFileDriver
);
if
(
isset
(
$joinColumnElement
[
'unique'
]))
{
$joinColumn
[
'unique'
]
=
(
bool
)
$joinColumnElement
[
'unique'
]
;
$joinColumn
[
'unique'
]
=
(
(
string
)
$joinColumnElement
[
'unique'
]
==
"false"
)
?
false
:
true
;
}
if
(
isset
(
$joinColumnElement
[
'nullable'
]))
{
$joinColumn
[
'nullable'
]
=
(
bool
)
$joinColumnElement
[
'nullable'
]
;
$joinColumn
[
'nullable'
]
=
(
(
string
)
$joinColumnElement
[
'nullable'
]
==
"false"
)
?
false
:
true
;
}
if
(
isset
(
$joinColumnElement
[
'onDelete'
]))
{
...
...
tests/Doctrine/Tests/ORM/Mapping/MappingDriverTest.php
View file @
a652bc69
...
...
@@ -50,7 +50,7 @@ class MappingDriverTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertEquals
(
1
,
count
(
$classNames
));
}
private
function
_testUserClassMapping
(
$class
)
private
function
_testUserClassMapping
(
ClassMetadata
$class
)
{
$this
->
assertEquals
(
'cms_users'
,
$class
->
getTableName
());
$this
->
assertEquals
(
ClassMetadata
::
INHERITANCE_TYPE_NONE
,
$class
->
getInheritanceType
());
...
...
@@ -58,6 +58,8 @@ class MappingDriverTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertTrue
(
isset
(
$class
->
fieldMappings
[
'id'
]));
$this
->
assertTrue
(
isset
(
$class
->
fieldMappings
[
'name'
]));
$this
->
assertEquals
(
'string'
,
$class
->
fieldMappings
[
'name'
][
'type'
]);
$this
->
assertTrue
(
$class
->
fieldMappings
[
'name'
][
'nullable'
]);
$this
->
assertTrue
(
$class
->
fieldMappings
[
'name'
][
'unique'
]);
$this
->
assertEquals
(
array
(
'id'
),
$class
->
identifier
);
$this
->
assertEquals
(
ClassMetadata
::
GENERATOR_TYPE_AUTO
,
$class
->
getIdGeneratorType
());
...
...
@@ -92,6 +94,10 @@ class MappingDriverTest extends \Doctrine\Tests\OrmTestCase
$this
->
assertTrue
(
$class
->
associationMappings
[
'groups'
]
->
isCascadeRefresh
);
$this
->
assertTrue
(
$class
->
associationMappings
[
'groups'
]
->
isCascadeDetach
);
$this
->
assertTrue
(
$class
->
associationMappings
[
'groups'
]
->
isCascadeMerge
);
// Non-Nullability of Join Column
$this
->
assertFalse
(
$class
->
associationMappings
[
'groups'
]
->
joinTable
[
'joinColumns'
][
0
][
'nullable'
]);
$this
->
assertFalse
(
$class
->
associationMappings
[
'groups'
]
->
joinTable
[
'joinColumns'
][
0
][
'unique'
]);
}
}
...
...
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.ORM.Mapping.User.dcm.xml
View file @
a652bc69
...
...
@@ -16,7 +16,7 @@
<generator
strategy=
"AUTO"
/>
</id>
<field
name=
"name"
column=
"name"
type=
"string"
length=
"50"
/>
<field
name=
"name"
column=
"name"
type=
"string"
length=
"50"
nullable=
"true"
unique=
"true"
/>
<one-to-one
field=
"address"
target-entity=
"Address"
>
<join-column
name=
"address_id"
referenced-column-name=
"id"
/>
...
...
@@ -34,7 +34,7 @@
<many-to-many
field=
"groups"
target-entity=
"Group"
>
<join-table
name=
"cms_users_groups"
>
<join-columns>
<join-column
name=
"user_id"
referenced-column-name=
"id"
/>
<join-column
name=
"user_id"
referenced-column-name=
"id"
nullable=
"false"
unique=
"false"
/>
</join-columns>
<inverse-join-columns>
<join-column
name=
"group_id"
referenced-column-name=
"id"
/>
...
...
tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.User.dcm.yml
View file @
a652bc69
...
...
@@ -10,6 +10,8 @@ Doctrine\Tests\ORM\Mapping\User:
name
:
type
:
string
length
:
50
nullable
:
true
unique
:
true
oneToOne
:
address
:
targetEntity
:
Address
...
...
@@ -30,6 +32,8 @@ Doctrine\Tests\ORM\Mapping\User:
joinColumns
:
user_id
:
referencedColumnName
:
id
nullable
:
false
unique
:
false
inverseJoinColumns
:
group_id
:
referencedColumnName
:
id
...
...
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