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
6210a606
Commit
6210a606
authored
Oct 02, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug when saving a record with null valued boolean column
parent
ba737729
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
27 deletions
+28
-27
Record.php
lib/Doctrine/Record.php
+6
-5
BooleanTestCase.php
tests/BooleanTestCase.php
+22
-22
No files found.
lib/Doctrine/Record.php
View file @
6210a606
...
@@ -862,6 +862,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -862,6 +862,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
foreach
(
$array
as
$k
=>
$v
)
{
foreach
(
$array
as
$k
=>
$v
)
{
$type
=
$this
->
table
->
getTypeOf
(
$v
);
$type
=
$this
->
table
->
getTypeOf
(
$v
);
if
(
$this
->
data
[
$v
]
===
self
::
$null
)
{
$a
[
$v
]
=
null
;
continue
;
}
switch
(
$type
)
{
switch
(
$type
)
{
case
'array'
:
case
'array'
:
...
@@ -881,11 +886,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -881,11 +886,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
if
(
$this
->
data
[
$v
]
instanceof
Doctrine_Record
)
if
(
$this
->
data
[
$v
]
instanceof
Doctrine_Record
)
$this
->
data
[
$v
]
=
$this
->
data
[
$v
]
->
getIncremented
();
$this
->
data
[
$v
]
=
$this
->
data
[
$v
]
->
getIncremented
();
$a
[
$v
]
=
$this
->
data
[
$v
];
if
(
$this
->
data
[
$v
]
===
self
::
$null
)
$a
[
$v
]
=
null
;
else
$a
[
$v
]
=
$this
->
data
[
$v
];
}
}
}
}
...
...
tests/BooleanTestCase.php
View file @
6210a606
...
@@ -5,28 +5,6 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
...
@@ -5,28 +5,6 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
$this
->
tables
=
array
(
"BooleanTest"
);
$this
->
tables
=
array
(
"BooleanTest"
);
parent
::
prepareTables
();
parent
::
prepareTables
();
}
}
public
function
testSetNull
()
{
$test
=
new
BooleanTest
();
$this
->
is_working
=
null
;
$this
->
assertEqual
(
$this
->
is_working
,
null
);
$this
->
assertEqual
(
$test
->
getState
(),
Doctrine_Record
::
STATE_TDIRTY
);
$test
->
save
();
$test
->
refresh
();
$this
->
assertEqual
(
$test
->
is_working
,
null
);
$test
=
new
BooleanTest
();
$this
->
is_working_notnull
=
null
;
$this
->
assertEqual
(
$this
->
is_working_notnull
,
false
);
$this
->
assertEqual
(
$test
->
getState
(),
Doctrine_Record
::
STATE_TDIRTY
);
$test
->
save
();
$test
->
refresh
();
$this
->
assertEqual
(
$test
->
is_working_notnull
,
false
);
}
public
function
testSetFalse
()
{
public
function
testSetFalse
()
{
$test
=
new
BooleanTest
();
$test
=
new
BooleanTest
();
...
@@ -84,5 +62,27 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
...
@@ -84,5 +62,27 @@ class Doctrine_BooleanTestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
count
(
$ret
),
1
);
$this
->
assertEqual
(
count
(
$ret
),
1
);
}
}
public
function
testSavingNullValue
()
{
$test
=
new
BooleanTest
();
$this
->
is_working
=
null
;
$this
->
assertEqual
(
$this
->
is_working
,
null
);
$this
->
assertEqual
(
$test
->
getState
(),
Doctrine_Record
::
STATE_TDIRTY
);
$test
->
save
();
$test
->
refresh
();
$this
->
assertEqual
(
$test
->
is_working
,
null
);
$test
=
new
BooleanTest
();
$this
->
is_working_notnull
=
null
;
$this
->
assertEqual
(
$this
->
is_working_notnull
,
false
);
$this
->
assertEqual
(
$test
->
getState
(),
Doctrine_Record
::
STATE_TDIRTY
);
$test
->
save
();
$test
->
refresh
();
$this
->
assertEqual
(
$test
->
is_working_notnull
,
false
);
}
}
}
?>
?>
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