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
0dd85678
Commit
0dd85678
authored
May 08, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Continued work on new hydration.
parent
f92773fa
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
423 additions
and
65 deletions
+423
-65
Hydrator.php
lib/Doctrine/Hydrator.php
+7
-3
ArrayDriver.php
lib/Doctrine/Hydrator/ArrayDriver.php
+1
-1
RecordDriver.php
lib/Doctrine/Hydrator/RecordDriver.php
+1
-1
HydratorNew.php
lib/Doctrine/HydratorNew.php
+37
-13
Mapper.php
lib/Doctrine/Mapper.php
+3
-1
Record.php
lib/Doctrine/Record.php
+14
-3
BasicHydrationTest.php
tests/Orm/Hydration/BasicHydrationTest.php
+321
-35
CmsArticle.php
tests/models/cms/CmsArticle.php
+2
-0
CmsComment.php
tests/models/cms/CmsComment.php
+11
-0
ForumBoard.php
tests/models/forum/ForumBoard.php
+9
-0
ForumCategory.php
tests/models/forum/ForumCategory.php
+9
-0
AccessTestCase.php
tests_old/AccessTestCase.php
+2
-2
CustomResultSetOrderTestCase.php
tests_old/CustomResultSetOrderTestCase.php
+1
-1
SynchronizeTestCase.php
tests_old/Record/SynchronizeTestCase.php
+1
-1
RecordTestCase.php
tests_old/RecordTestCase.php
+3
-3
OneToOneTestCase.php
tests_old/Relation/OneToOneTestCase.php
+1
-1
No files found.
lib/Doctrine/Hydrator.php
View file @
0dd85678
...
@@ -197,7 +197,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
...
@@ -197,7 +197,7 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
$oneToOne
=
false
;
$oneToOne
=
false
;
// append element
// append element
if
(
isset
(
$nonemptyComponents
[
$dqlAlias
]))
{
if
(
isset
(
$nonemptyComponents
[
$dqlAlias
]))
{
$driver
->
initRelated
(
$prev
[
$parent
],
$relationAlias
);
$driver
->
initRelated
Collection
(
$prev
[
$parent
],
$relationAlias
);
if
(
!
isset
(
$identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]))
{
if
(
!
isset
(
$identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]))
{
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
...
@@ -225,6 +225,8 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
...
@@ -225,6 +225,8 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
}
}
// register collection for later snapshots
// register collection for later snapshots
//$driver->registerCollection($prev[$parent][$relationAlias]);
//$driver->registerCollection($prev[$parent][$relationAlias]);
}
else
if
(
!
isset
(
$prev
[
$parent
][
$relationAlias
]))
{
$prev
[
$parent
][
$relationAlias
]
=
$driver
->
getNullPointer
();
}
}
}
else
{
}
else
{
// 1-1 relation
// 1-1 relation
...
@@ -236,10 +238,12 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
...
@@ -236,10 +238,12 @@ class Doctrine_Hydrator extends Doctrine_Hydrator_Abstract
$prev
[
$parent
][
$relationAlias
]
=
$element
;
$prev
[
$parent
][
$relationAlias
]
=
$element
;
}
}
}
}
if
(
$prev
[
$parent
][
$relationAlias
]
!==
null
)
{
$coll
=&
$prev
[
$parent
][
$relationAlias
];
$coll
=&
$prev
[
$parent
][
$relationAlias
];
$this
->
_setLastElement
(
$prev
,
$coll
,
$index
,
$dqlAlias
,
$oneToOne
);
$this
->
_setLastElement
(
$prev
,
$coll
,
$index
,
$dqlAlias
,
$oneToOne
);
}
}
}
}
}
$stmt
->
closeCursor
();
$stmt
->
closeCursor
();
...
...
lib/Doctrine/Hydrator/ArrayDriver.php
View file @
0dd85678
...
@@ -66,7 +66,7 @@ class Doctrine_Hydrator_ArrayDriver
...
@@ -66,7 +66,7 @@ class Doctrine_Hydrator_ArrayDriver
/**
/**
*
*
*/
*/
public
function
initRelated
(
array
&
$data
,
$name
)
public
function
initRelated
Collection
(
array
&
$data
,
$name
)
{
{
if
(
!
isset
(
$data
[
$name
]))
{
if
(
!
isset
(
$data
[
$name
]))
{
$data
[
$name
]
=
array
();
$data
[
$name
]
=
array
();
...
...
lib/Doctrine/Hydrator/RecordDriver.php
View file @
0dd85678
...
@@ -68,7 +68,7 @@ class Doctrine_Hydrator_RecordDriver
...
@@ -68,7 +68,7 @@ class Doctrine_Hydrator_RecordDriver
}
}
}
}
public
function
initRelated
(
Doctrine_Record
$record
,
$name
)
public
function
initRelated
Collection
(
Doctrine_Record
$record
,
$name
)
{
{
if
(
!
isset
(
$this
->
_initializedRelations
[
$record
->
getOid
()][
$name
]))
{
if
(
!
isset
(
$this
->
_initializedRelations
[
$record
->
getOid
()][
$name
]))
{
$relation
=
$record
->
getClassMetadata
()
->
getRelation
(
$name
);
$relation
=
$record
->
getClassMetadata
()
->
getRelation
(
$name
);
...
...
lib/Doctrine/HydratorNew.php
View file @
0dd85678
...
@@ -20,8 +20,27 @@
...
@@ -20,8 +20,27 @@
*/
*/
/**
/**
* The hydrator has the tedious task to construct object or array graphs out of
* The hydrator has the tedious to process result sets returned by the database
* a database result set.
* and turn them into useable structures.
*
* Runtime complexity: The following gives the overall number of iterations
* required to process a result set.
*
* <code>numRowsInResult * numColumnsInResult + numRowsInResult * numClassesInQuery</code>
*
* This comes down to:
*
* <code>(numRowsInResult * (numColumnsInResult + numClassesInQuery))</code>
*
* Note that this is only a crude definition of the complexity as it also heavily
* depends on the complexity of all the single operations that are performed in
* each iteration.
*
* As can be seen, the number of columns in the result has the most impact on
* the overall performance (apart from the row counr, of course), since numClassesInQuery
* is usually pretty low.
* That's why the performance of the gatherRowData() method which is responsible
* for the "numRowsInResult * numColumnsInResult" part is crucial to fast hydraton.
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Hydrator
* @subpackage Hydrator
...
@@ -153,9 +172,9 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -153,9 +172,9 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
// do we need to index by a custom field?
// do we need to index by a custom field?
if
(
$field
=
$this
->
_getCustomIndexField
(
$rootAlias
))
{
if
(
$field
=
$this
->
_getCustomIndexField
(
$rootAlias
))
{
if
(
isset
(
$result
[
$field
]))
{
if
(
isset
(
$result
[
$field
]))
{
throw
new
Doctrine_Hydrator_Exception
(
"Couldn't hydrate. Found non-unique key mapping."
);
throw
Doctrine_Hydrator_Exception
::
nonUniqueKeyMapping
(
);
}
else
if
(
!
isset
(
$element
[
$field
]))
{
}
else
if
(
!
isset
(
$element
[
$field
]))
{
throw
new
Doctrine_Hydrator_Exception
(
"Couldn't hydrate. Found a non-existent key."
);
throw
Doctrine_Hydrator_Exception
::
nonExistantFieldUsedAsIndex
(
$field
);
}
}
if
(
$this
->
_isResultMixed
)
{
if
(
$this
->
_isResultMixed
)
{
$result
[]
=
array
(
$element
[
$field
]
=>
$element
);
$result
[]
=
array
(
$element
[
$field
]
=>
$element
);
...
@@ -169,7 +188,6 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -169,7 +188,6 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$result
[]
=
$element
;
$result
[]
=
$element
;
}
}
}
}
$identifierMap
[
$rootAlias
][
$id
[
$rootAlias
]]
=
$driver
->
getLastKey
(
$result
);
$identifierMap
[
$rootAlias
][
$id
[
$rootAlias
]]
=
$driver
->
getLastKey
(
$result
);
}
else
{
}
else
{
$index
=
$identifierMap
[
$rootAlias
][
$id
[
$rootAlias
]];
$index
=
$identifierMap
[
$rootAlias
][
$id
[
$rootAlias
]];
...
@@ -185,7 +203,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -185,7 +203,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
unset
(
$rowData
[
'scalars'
]);
unset
(
$rowData
[
'scalars'
]);
}
}
// $
prev
[$rootAlias] now points to the last element in $result.
// $
resultPointers
[$rootAlias] now points to the last element in $result.
// now hydrate the rest of the data found in the current row, that belongs to other
// now hydrate the rest of the data found in the current row, that belongs to other
// (related) components.
// (related) components.
foreach
(
$rowData
as
$dqlAlias
=>
$data
)
{
foreach
(
$rowData
as
$dqlAlias
=>
$data
)
{
...
@@ -204,8 +222,10 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -204,8 +222,10 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$path
=
$parent
.
'.'
.
$dqlAlias
;
$path
=
$parent
.
'.'
.
$dqlAlias
;
// pick the right element that will get the associated element attached
if
(
$this
->
_isResultMixed
&&
$parent
==
$rootAlias
)
{
$key
=
key
(
reset
(
$resultPointers
));
$key
=
key
(
reset
(
$resultPointers
));
if
(
$this
->
_isResultMixed
&&
$parent
==
$rootAlias
&&
isset
(
$resultPointers
[
$parent
][
$key
]))
{
// TODO: Exception if $key === null ?
$baseElement
=&
$resultPointers
[
$parent
][
$key
];
$baseElement
=&
$resultPointers
[
$parent
][
$key
];
}
else
if
(
isset
(
$resultPointers
[
$parent
]))
{
}
else
if
(
isset
(
$resultPointers
[
$parent
]))
{
$baseElement
=&
$resultPointers
[
$parent
];
$baseElement
=&
$resultPointers
[
$parent
];
...
@@ -218,7 +238,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -218,7 +238,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
// x-many relation
// x-many relation
$oneToOne
=
false
;
$oneToOne
=
false
;
if
(
isset
(
$nonemptyComponents
[
$dqlAlias
]))
{
if
(
isset
(
$nonemptyComponents
[
$dqlAlias
]))
{
$driver
->
initRelated
(
$baseElement
,
$relationAlias
);
$driver
->
initRelated
Collection
(
$baseElement
,
$relationAlias
);
if
(
!
isset
(
$identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]))
{
if
(
!
isset
(
$identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]]))
{
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
$element
=
$driver
->
getElement
(
$data
,
$componentName
);
...
@@ -244,6 +264,8 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -244,6 +264,8 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
}
else
{
}
else
{
$index
=
$identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]];
$index
=
$identifierMap
[
$path
][
$id
[
$parent
]][
$id
[
$dqlAlias
]];
}
}
}
else
if
(
!
isset
(
$baseElement
[
$relationAlias
]))
{
$baseElement
[
$relationAlias
]
=
$driver
->
getNullPointer
();
}
}
}
else
{
}
else
{
// x-1 relation
// x-1 relation
...
@@ -254,9 +276,11 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
...
@@ -254,9 +276,11 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$baseElement
[
$relationAlias
]
=
$driver
->
getElement
(
$data
,
$componentName
);
$baseElement
[
$relationAlias
]
=
$driver
->
getElement
(
$data
,
$componentName
);
}
}
}
}
if
(
$baseElement
[
$relationAlias
]
!==
null
)
{
$coll
=&
$baseElement
[
$relationAlias
];
$coll
=&
$baseElement
[
$relationAlias
];
$this
->
_setLastElement
(
$resultPointers
,
$coll
,
$index
,
$dqlAlias
,
$oneToOne
);
$this
->
_setLastElement
(
$resultPointers
,
$coll
,
$index
,
$dqlAlias
,
$oneToOne
);
}
}
}
// append scalar values
// append scalar values
if
(
isset
(
$scalars
))
{
if
(
isset
(
$scalars
))
{
...
...
lib/Doctrine/Mapper.php
View file @
0dd85678
...
@@ -615,7 +615,9 @@ class Doctrine_Mapper
...
@@ -615,7 +615,9 @@ class Doctrine_Mapper
public
function
saveAssociations
(
Doctrine_Record
$record
)
public
function
saveAssociations
(
Doctrine_Record
$record
)
{
{
foreach
(
$record
->
getReferences
()
as
$relationName
=>
$relatedObject
)
{
foreach
(
$record
->
getReferences
()
as
$relationName
=>
$relatedObject
)
{
if
(
$relatedObject
===
Doctrine_Null
::
$INSTANCE
)
{
continue
;
}
$rel
=
$record
->
getTable
()
->
getRelation
(
$relationName
);
$rel
=
$record
->
getTable
()
->
getRelation
(
$relationName
);
if
(
$rel
instanceof
Doctrine_Relation_Association
)
{
if
(
$rel
instanceof
Doctrine_Relation_Association
)
{
...
...
lib/Doctrine/Record.php
View file @
0dd85678
...
@@ -928,6 +928,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -928,6 +928,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$rel
=
$this
->
_class
->
getRelation
(
$fieldName
);
$rel
=
$this
->
_class
->
getRelation
(
$fieldName
);
$this
->
_references
[
$fieldName
]
=
$rel
->
fetchRelatedFor
(
$this
);
$this
->
_references
[
$fieldName
]
=
$rel
->
fetchRelatedFor
(
$this
);
}
}
if
(
$this
->
_references
[
$fieldName
]
===
Doctrine_Null
::
$INSTANCE
)
{
return
null
;
}
return
$this
->
_references
[
$fieldName
];
return
$this
->
_references
[
$fieldName
];
}
catch
(
Doctrine_Relation_Exception
$e
)
{
}
catch
(
Doctrine_Relation_Exception
$e
)
{
//echo $e->getTraceAsString();
//echo $e->getTraceAsString();
...
@@ -1038,6 +1041,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -1038,6 +1041,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*/
*/
private
function
_coreSetRelated
(
$name
,
$value
)
private
function
_coreSetRelated
(
$name
,
$value
)
{
{
if
(
$value
===
Doctrine_Null
::
$INSTANCE
)
{
$this
->
_references
[
$name
]
=
$value
;
return
;
}
$rel
=
$this
->
_class
->
getRelation
(
$name
);
$rel
=
$this
->
_class
->
getRelation
(
$name
);
// one-to-many or one-to-one relation
// one-to-many or one-to-one relation
...
@@ -1045,7 +1053,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -1045,7 +1053,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$rel
instanceof
Doctrine_Relation_LocalKey
)
{
$rel
instanceof
Doctrine_Relation_LocalKey
)
{
if
(
!
$rel
->
isOneToOne
())
{
if
(
!
$rel
->
isOneToOne
())
{
// one-to-many relation found
// one-to-many relation found
if
(
!
(
$value
instanceof
Doctrine_Collection
)
)
{
if
(
!
$value
instanceof
Doctrine_Collection
)
{
throw
new
Doctrine_Record_Exception
(
"Couldn't call Doctrine::set(), second"
throw
new
Doctrine_Record_Exception
(
"Couldn't call Doctrine::set(), second"
.
" argument should be an instance of Doctrine_Collection when"
.
" argument should be an instance of Doctrine_Collection when"
.
" setting one-to-many references."
);
.
" setting one-to-many references."
);
...
@@ -1067,7 +1075,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -1067,7 +1075,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
.
" or Doctrine_Null when setting one-to-one references."
);
.
" or Doctrine_Null when setting one-to-one references."
);
}
}
if
(
$rel
instanceof
Doctrine_Relation_LocalKey
)
{
if
(
$rel
instanceof
Doctrine_Relation_LocalKey
)
{
$idFieldNames
=
(
array
)
$value
->
getTable
()
->
getIdentifier
();
$idFieldNames
=
$value
->
getTable
()
->
getIdentifier
();
if
(
!
empty
(
$foreignFieldName
)
&&
$foreignFieldName
!=
$idFieldNames
[
0
])
{
if
(
!
empty
(
$foreignFieldName
)
&&
$foreignFieldName
!=
$idFieldNames
[
0
])
{
$this
->
set
(
$localFieldName
,
$value
->
rawGet
(
$foreignFieldName
),
false
);
$this
->
set
(
$localFieldName
,
$value
->
rawGet
(
$foreignFieldName
),
false
);
}
else
{
}
else
{
...
@@ -1097,6 +1105,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
...
@@ -1097,6 +1105,9 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
public
function
contains
(
$fieldName
)
public
function
contains
(
$fieldName
)
{
{
if
(
isset
(
$this
->
_data
[
$fieldName
]))
{
if
(
isset
(
$this
->
_data
[
$fieldName
]))
{
if
(
$this
->
_data
[
$fieldName
]
===
Doctrine_Null
::
$INSTANCE
)
{
return
false
;
}
return
true
;
return
true
;
}
}
if
(
isset
(
$this
->
_id
[
$fieldName
]))
{
if
(
isset
(
$this
->
_id
[
$fieldName
]))
{
...
...
tests/Orm/Hydration/BasicHydrationTest.php
View file @
0dd85678
...
@@ -9,22 +9,21 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
...
@@ -9,22 +9,21 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
parent
::
setUp
();
parent
::
setUp
();
}
}
/** The data of the hydration mode dataProvider */
protected
static
$hydrationModeProviderData
=
array
(
array
(
'hydrationMode'
=>
Doctrine
::
HYDRATE_RECORD
),
array
(
'hydrationMode'
=>
Doctrine
::
HYDRATE_ARRAY
)
);
/** Getter for the hydration mode dataProvider */
/** Getter for the hydration mode dataProvider */
public
static
function
hydrationModeProvider
()
public
static
function
hydrationModeProvider
()
{
{
return
self
::
$hydrationModeProviderData
;
return
array
(
array
(
'hydrationMode'
=>
Doctrine
::
HYDRATE_RECORD
),
array
(
'hydrationMode'
=>
Doctrine
::
HYDRATE_ARRAY
)
);
}
}
/**
/**
* Select u.id, u.name from CmsUser u
* Select u.id, u.name from CmsUser u
*
*
* @dataProvider hydrationModeProvider
*/
*/
public
function
test
BasicHydration
(
)
public
function
test
NewHydrationSimpleEntityQuery
(
$hydrationMode
)
{
{
// Faked query components
// Faked query components
$queryComponents
=
array
(
$queryComponents
=
array
(
...
@@ -44,12 +43,10 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
...
@@ -44,12 +43,10 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
// Faked result set
// Faked result set
$resultSet
=
array
(
$resultSet
=
array
(
//row1
array
(
array
(
'u__id'
=>
'1'
,
'u__id'
=>
'1'
,
'u__name'
=>
'romanb'
'u__name'
=>
'romanb'
),
),
//row2
array
(
array
(
'u__id'
=>
'2'
,
'u__id'
=>
'2'
,
'u__name'
=>
'jwage'
'u__name'
=>
'jwage'
...
@@ -58,30 +55,24 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
...
@@ -58,30 +55,24 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_Hydrator
();
$hydrator
=
new
Doctrine_Hydrator
New
();
$hydrator
->
setQueryComponents
(
$queryComponents
);
$hydrator
->
setQueryComponents
(
$queryComponents
);
$arrayResult
=
$hydrator
->
hydrateResultSet
(
$stmt
,
$tableAliasMap
,
Doctrine
::
HYDRATE_ARRAY
);
$result
=
$hydrator
->
hydrateResultSet
(
$stmt
,
$tableAliasMap
,
$hydrationMode
);
$this
->
assertTrue
(
is_array
(
$arrayResult
));
$this
->
assertEquals
(
2
,
count
(
$arrayResult
));
$this
->
assertEquals
(
1
,
$arrayResult
[
0
][
'id'
]);
$this
->
assertEquals
(
'romanb'
,
$arrayResult
[
0
][
'name'
]);
$this
->
assertEquals
(
2
,
$arrayResult
[
1
][
'id'
]);
$this
->
assertEquals
(
'jwage'
,
$arrayResult
[
1
][
'name'
]);
$stmt
->
setResultSet
(
$resultSet
);
$objectResult
=
$hydrator
->
hydrateResultSet
(
$stmt
,
$tableAliasMap
,
Doctrine
::
HYDRATE_RECORD
);
$this
->
assertTrue
(
$objectResult
instanceof
Doctrine_Collection
);
$this
->
assertEquals
(
2
,
count
(
$result
));
$this
->
assertEquals
(
2
,
count
(
$objectResult
));
$this
->
assertEquals
(
1
,
$result
[
0
][
'id'
]);
$this
->
assertTrue
(
$objectResult
[
0
]
instanceof
Doctrine_Record
);
$this
->
assertEquals
(
'romanb'
,
$result
[
0
][
'name'
]);
$this
->
assertEquals
(
1
,
$objectResult
[
0
]
->
id
);
$this
->
assertEquals
(
2
,
$result
[
1
][
'id'
]);
$this
->
assertEquals
(
'romanb'
,
$objectResult
[
0
]
->
name
);
$this
->
assertEquals
(
'jwage'
,
$result
[
1
][
'name'
]);
$this
->
assertTrue
(
$objectResult
[
1
]
instanceof
Doctrine_Record
);
$this
->
assertEquals
(
2
,
$objectResult
[
1
]
->
id
);
$this
->
assertEquals
(
'jwage'
,
$objectResult
[
1
]
->
name
);
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
1
]
instanceof
Doctrine_Record
);
}
else
{
$this
->
assertTrue
(
is_array
(
$result
));
}
}
}
/**
/**
...
@@ -188,7 +179,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
...
@@ -188,7 +179,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
*
*
* @dataProvider hydrationModeProvider
* @dataProvider hydrationModeProvider
*/
*/
public
function
testNewHydration
Basics
MixedQueryNormalJoin
(
$hydrationMode
)
public
function
testNewHydrationMixedQueryNormalJoin
(
$hydrationMode
)
{
{
// Faked query components
// Faked query components
$queryComponents
=
array
(
$queryComponents
=
array
(
...
@@ -354,11 +345,10 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
...
@@ -354,11 +345,10 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$this
->
assertTrue
(
$result
[
0
][
'1'
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
'1'
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertEquals
(
2
,
count
(
$result
[
0
][
'1'
][
'phonenumbers'
]));
$this
->
assertEquals
(
2
,
count
(
$result
[
0
][
'1'
][
'phonenumbers'
]));
}
}
}
}
/**
/**
* select u.id, u.status, p.phonenumber, upper(u.name) nameUpper, a.id, a.topic
* select u.id, u.status, p.phonenumber, upper(u.name) nameUpper, a.id, a.topic
* from User u
* from User u
* join u.phonenumbers p
* join u.phonenumbers p
...
@@ -509,8 +499,304 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
...
@@ -509,8 +499,304 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
}
}
}
}
/**
* select u.id, u.status, p.phonenumber, upper(u.name) nameUpper, a.id, a.topic,
* c.id, c.topic
* from User u
* join u.phonenumbers p
* join u.articles a
* left join a.comments c
* =
* select u.id, u.status, p.phonenumber, upper(u.name) as u__0, a.id, a.topic,
* c.id, c.topic
* from USERS u
* inner join PHONENUMBERS p ON u.id = p.user_id
* inner join ARTICLES a ON u.id = a.user_id
* left outer join COMMENTS c ON a.id = c.article_id
*
* @dataProvider hydrationModeProvider
*/
public
function
testNewHydrationMixedQueryMultipleDeepMixedFetchJoin
(
$hydrationMode
)
{
// Faked query components
$queryComponents
=
array
(
'u'
=>
array
(
'table'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsUser'
),
'mapper'
=>
$this
->
sharedFixture
[
'connection'
]
->
getMapper
(
'CmsUser'
),
'parent'
=>
null
,
'relation'
=>
null
,
'map'
=>
null
,
'agg'
=>
array
(
'0'
=>
'nameUpper'
)
),
'p'
=>
array
(
'table'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsPhonenumber'
),
'mapper'
=>
$this
->
sharedFixture
[
'connection'
]
->
getMapper
(
'CmsPhonenumber'
),
'parent'
=>
'u'
,
'relation'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsUser'
)
->
getRelation
(
'phonenumbers'
),
'map'
=>
null
),
'a'
=>
array
(
'table'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsArticle'
),
'mapper'
=>
$this
->
sharedFixture
[
'connection'
]
->
getMapper
(
'CmsArticle'
),
'parent'
=>
'u'
,
'relation'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsUser'
)
->
getRelation
(
'articles'
),
'map'
=>
null
),
'c'
=>
array
(
'table'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsComment'
),
'mapper'
=>
$this
->
sharedFixture
[
'connection'
]
->
getMapper
(
'CmsComment'
),
'parent'
=>
'a'
,
'relation'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'CmsArticle'
)
->
getRelation
(
'comments'
),
'map'
=>
null
),
);
// Faked table alias map
$tableAliasMap
=
array
(
'u'
=>
'u'
,
'p'
=>
'p'
,
'a'
=>
'a'
,
'c'
=>
'c'
);
// Faked result set
$resultSet
=
array
(
//row1
array
(
'u__id'
=>
'1'
,
'u__status'
=>
'developer'
,
'u__0'
=>
'ROMANB'
,
'p__phonenumber'
=>
'42'
,
'a__id'
=>
'1'
,
'a__topic'
=>
'Getting things done!'
,
'c__id'
=>
'1'
,
'c__topic'
=>
'First!'
),
array
(
'u__id'
=>
'1'
,
'u__status'
=>
'developer'
,
'u__0'
=>
'ROMANB'
,
'p__phonenumber'
=>
'43'
,
'a__id'
=>
'1'
,
'a__topic'
=>
'Getting things done!'
,
'c__id'
=>
'1'
,
'c__topic'
=>
'First!'
),
array
(
'u__id'
=>
'1'
,
'u__status'
=>
'developer'
,
'u__0'
=>
'ROMANB'
,
'p__phonenumber'
=>
'42'
,
'a__id'
=>
'2'
,
'a__topic'
=>
'ZendCon'
,
'c__id'
=>
null
,
'c__topic'
=>
null
),
array
(
'u__id'
=>
'1'
,
'u__status'
=>
'developer'
,
'u__0'
=>
'ROMANB'
,
'p__phonenumber'
=>
'43'
,
'a__id'
=>
'2'
,
'a__topic'
=>
'ZendCon'
,
'c__id'
=>
null
,
'c__topic'
=>
null
),
array
(
'u__id'
=>
'2'
,
'u__status'
=>
'developer'
,
'u__0'
=>
'JWAGE'
,
'p__phonenumber'
=>
'91'
,
'a__id'
=>
'3'
,
'a__topic'
=>
'LINQ'
,
'c__id'
=>
null
,
'c__topic'
=>
null
),
array
(
'u__id'
=>
'2'
,
'u__status'
=>
'developer'
,
'u__0'
=>
'JWAGE'
,
'p__phonenumber'
=>
'91'
,
'a__id'
=>
'4'
,
'a__topic'
=>
'PHP6'
,
'c__id'
=>
null
,
'c__topic'
=>
null
),
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_HydratorNew
();
$hydrator
->
setQueryComponents
(
$queryComponents
);
$hydrator
->
setResultMixed
(
true
);
$result
=
$hydrator
->
hydrateResultSet
(
$stmt
,
$tableAliasMap
,
$hydrationMode
);
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_ARRAY
)
{
//var_dump($result);
}
$this
->
assertEquals
(
2
,
count
(
$result
));
$this
->
assertTrue
(
is_array
(
$result
));
$this
->
assertTrue
(
is_array
(
$result
[
0
]));
$this
->
assertTrue
(
is_array
(
$result
[
1
]));
// first user => 2 phonenumbers, 2 articles, 1 comment on first article
$this
->
assertEquals
(
2
,
count
(
$result
[
0
][
0
][
'phonenumbers'
]));
$this
->
assertEquals
(
2
,
count
(
$result
[
0
][
0
][
'articles'
]));
$this
->
assertEquals
(
1
,
count
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
]));
$this
->
assertEquals
(
'ROMANB'
,
$result
[
0
][
'nameUpper'
]);
// second user => 1 phonenumber, 2 articles, no comments
$this
->
assertEquals
(
1
,
count
(
$result
[
1
][
0
][
'phonenumbers'
]));
$this
->
assertEquals
(
2
,
count
(
$result
[
1
][
0
][
'articles'
]));
$this
->
assertEquals
(
'JWAGE'
,
$result
[
1
][
'nameUpper'
]);
$this
->
assertEquals
(
42
,
$result
[
0
][
0
][
'phonenumbers'
][
0
][
'phonenumber'
]);
$this
->
assertEquals
(
43
,
$result
[
0
][
0
][
'phonenumbers'
][
1
][
'phonenumber'
]);
$this
->
assertEquals
(
91
,
$result
[
1
][
0
][
'phonenumbers'
][
0
][
'phonenumber'
]);
$this
->
assertEquals
(
'Getting things done!'
,
$result
[
0
][
0
][
'articles'
][
0
][
'topic'
]);
$this
->
assertEquals
(
'ZendCon'
,
$result
[
0
][
0
][
'articles'
][
1
][
'topic'
]);
$this
->
assertEquals
(
'LINQ'
,
$result
[
1
][
0
][
'articles'
][
0
][
'topic'
]);
$this
->
assertEquals
(
'PHP6'
,
$result
[
1
][
0
][
'articles'
][
1
][
'topic'
]);
$this
->
assertEquals
(
'First!'
,
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
][
0
][
'topic'
]);
$this
->
assertTrue
(
isset
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
]));
$this
->
assertFalse
(
isset
(
$result
[
0
][
0
][
'articles'
][
1
][
'comments'
]));
$this
->
assertFalse
(
isset
(
$result
[
1
][
0
][
'articles'
][
0
][
'comments'
]));
$this
->
assertFalse
(
isset
(
$result
[
1
][
0
][
'articles'
][
1
][
'comments'
]));
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_RECORD
)
{
$this
->
assertTrue
(
$result
[
0
][
0
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
1
][
0
]
instanceof
Doctrine_Record
);
// phonenumbers
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'phonenumbers'
][
1
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'phonenumbers'
][
0
]
instanceof
Doctrine_Record
);
// articles
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
1
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
0
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
1
][
0
][
'articles'
][
1
]
instanceof
Doctrine_Record
);
// article comments
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
]
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
][
0
][
'articles'
][
0
][
'comments'
][
0
]
instanceof
Doctrine_Record
);
}
}
/**
* Tests that the hydrator does not rely on a particular order of the rows
* in the result set.
*
* DQL:
* select c.id, c.position, c.name, b.id, b.position
* from ForumCategory c inner join c.boards b
* order by c.position asc, b.position asc
*
* Checks whether the boards are correctly assigned to the categories.
*
* The 'evil' result set that confuses the object population is displayed below.
*
* c.id | c.position | c.name | boardPos | b.id | b.category_id (just for clarity)
* 1 | 0 | First | 0 | 1 | 1
* 2 | 0 | Second | 0 | 2 | 2 <--
* 1 | 0 | First | 1 | 3 | 1
* 1 | 0 | First | 2 | 4 | 1
*
* @dataProvider hydrationModeProvider
*/
public
function
testNewHydrationEntityQueryCustomResultSetOrder
(
$hydrationMode
)
{
// Faked query components
$queryComponents
=
array
(
'c'
=>
array
(
'table'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'ForumCategory'
),
'mapper'
=>
$this
->
sharedFixture
[
'connection'
]
->
getMapper
(
'ForumCategory'
),
'parent'
=>
null
,
'relation'
=>
null
,
'map'
=>
null
),
'b'
=>
array
(
'table'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'ForumBoard'
),
'mapper'
=>
$this
->
sharedFixture
[
'connection'
]
->
getMapper
(
'ForumBoard'
),
'parent'
=>
'c'
,
'relation'
=>
$this
->
sharedFixture
[
'connection'
]
->
getClassMetadata
(
'ForumCategory'
)
->
getRelation
(
'boards'
),
'map'
=>
null
),
);
// Faked table alias map
$tableAliasMap
=
array
(
'c'
=>
'c'
,
'b'
=>
'b'
);
// Faked result set
$resultSet
=
array
(
array
(
'c__id'
=>
'1'
,
'c__position'
=>
'0'
,
'c__name'
=>
'First'
,
'b__id'
=>
'1'
,
'b__position'
=>
'0'
,
'b__category_id'
=>
'1'
),
array
(
'c__id'
=>
'2'
,
'c__position'
=>
'0'
,
'c__name'
=>
'Second'
,
'b__id'
=>
'2'
,
'b__position'
=>
'0'
,
'b__category_id'
=>
'2'
),
array
(
'c__id'
=>
'1'
,
'c__position'
=>
'0'
,
'c__name'
=>
'First'
,
'b__id'
=>
'3'
,
'b__position'
=>
'1'
,
'b__category_id'
=>
'1'
),
array
(
'c__id'
=>
'1'
,
'c__position'
=>
'0'
,
'c__name'
=>
'First'
,
'b__id'
=>
'4'
,
'b__position'
=>
'2'
,
'b__category_id'
=>
'1'
)
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_HydratorNew
();
$hydrator
->
setQueryComponents
(
$queryComponents
);
//$hydrator->setResultMixed(true);
$result
=
$hydrator
->
hydrateResultSet
(
$stmt
,
$tableAliasMap
,
$hydrationMode
);
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_ARRAY
)
{
//var_dump($result);
}
$this
->
assertEquals
(
2
,
count
(
$result
));
$this
->
assertTrue
(
isset
(
$result
[
0
][
'boards'
]));
$this
->
assertEquals
(
3
,
count
(
$result
[
0
][
'boards'
]));
$this
->
assertTrue
(
isset
(
$result
[
1
][
'boards'
]));
$this
->
assertEquals
(
1
,
count
(
$result
[
1
][
'boards'
]));
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_ARRAY
)
{
$this
->
assertTrue
(
is_array
(
$result
));
$this
->
assertTrue
(
is_array
(
$result
[
0
]));
$this
->
assertTrue
(
is_array
(
$result
[
1
]));
}
else
{
$this
->
assertTrue
(
$result
instanceof
Doctrine_Collection
);
$this
->
assertTrue
(
$result
[
0
]
instanceof
Doctrine_Record
);
$this
->
assertTrue
(
$result
[
1
]
instanceof
Doctrine_Record
);
}
}
}
}
\ No newline at end of file
tests/models/cms/CmsArticle.php
View file @
0dd85678
...
@@ -7,5 +7,7 @@ class CmsArticle extends Doctrine_Record
...
@@ -7,5 +7,7 @@ class CmsArticle extends Doctrine_Record
$class
->
mapColumn
(
'topic'
,
'string'
,
255
);
$class
->
mapColumn
(
'topic'
,
'string'
,
255
);
$class
->
mapColumn
(
'text'
,
'string'
);
$class
->
mapColumn
(
'text'
,
'string'
);
$class
->
mapColumn
(
'user_id'
,
'integer'
,
4
);
$class
->
mapColumn
(
'user_id'
,
'integer'
,
4
);
$class
->
hasMany
(
'CmsComment as comments'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'article_id'
));
}
}
}
}
tests/models/cms/CmsComment.php
0 → 100644
View file @
0dd85678
<?php
class
CmsComment
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
mapColumn
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$class
->
mapColumn
(
'topic'
,
'string'
,
255
);
$class
->
mapColumn
(
'text'
,
'string'
);
$class
->
mapColumn
(
'article_id'
,
'integer'
,
4
);
}
}
tests/models/forum/ForumBoard.php
0 → 100644
View file @
0dd85678
<?php
class
ForumBoard
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
mapColumn
(
'position'
,
'integer'
);
$class
->
mapColumn
(
'category_id'
,
'integer'
);
$class
->
hasOne
(
'ForumCategory as category'
,
array
(
'local'
=>
'category_id'
,
'foreign'
=>
'id'
));
}
}
tests/models/forum/ForumCategory.php
0 → 100644
View file @
0dd85678
<?php
class
ForumCategory
extends
Doctrine_Record
{
public
static
function
initMetadata
(
$class
)
{
$class
->
mapColumn
(
'position'
,
'integer'
);
$class
->
mapColumn
(
'name'
,
'string'
,
255
);
$class
->
hasMany
(
'ForumBoard as boards'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'category_id'
));
}
}
tests_old/AccessTestCase.php
View file @
0dd85678
...
@@ -49,10 +49,10 @@ class Doctrine_Access_TestCase extends Doctrine_UnitTestCase
...
@@ -49,10 +49,10 @@ class Doctrine_Access_TestCase extends Doctrine_UnitTestCase
{
{
$user
=
new
User
();
$user
=
new
User
();
$this
->
assertTrue
(
isset
(
$user
->
name
));
$this
->
assertTrue
(
!
isset
(
$user
->
name
));
$this
->
assertFalse
(
isset
(
$user
->
unknown
));
$this
->
assertFalse
(
isset
(
$user
->
unknown
));
$this
->
assertTrue
(
isset
(
$user
[
'name'
]));
$this
->
assertTrue
(
!
isset
(
$user
[
'name'
]));
$this
->
assertFalse
(
isset
(
$user
[
'unknown'
]));
$this
->
assertFalse
(
isset
(
$user
[
'unknown'
]));
$coll
=
new
Doctrine_Collection
(
'User'
);
$coll
=
new
Doctrine_Collection
(
'User'
);
...
...
tests_old/CustomResultSetOrderTestCase.php
View file @
0dd85678
...
@@ -169,7 +169,7 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
...
@@ -169,7 +169,7 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
case
'Third'
:
case
'Third'
:
// The third has no boards as expected.
// The third has no boards as expected.
//print $category->Boards[0]->position;
//print $category->Boards[0]->position;
$this
->
assert
Equal
(
0
,
$category
->
Boards
->
count
(
));
$this
->
assert
True
(
!
isset
(
$category
->
Boards
));
break
;
break
;
}
}
...
...
tests_old/Record/SynchronizeTestCase.php
View file @
0dd85678
...
@@ -115,7 +115,7 @@ class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase
...
@@ -115,7 +115,7 @@ class Doctrine_Record_Synchronize_TestCase extends Doctrine_UnitTestCase
public
function
testSynchronizeAfterRemoveRecord
()
public
function
testSynchronizeAfterRemoveRecord
()
{
{
$user
=
Doctrine_Query
::
create
()
->
from
(
'User u, u.Email, u.Phonenumber'
)
->
fetchOne
();
$user
=
Doctrine_Query
::
create
()
->
from
(
'User u, u.Email, u.Phonenumber'
)
->
fetchOne
();
$this
->
assert
Equal
(
$user
->
Phonenumber
->
count
(),
0
);
$this
->
assert
True
(
!
isset
(
$user
->
Phonenumber
)
);
$this
->
assertTrue
(
!
isset
(
$user
->
Email
));
$this
->
assertTrue
(
!
isset
(
$user
->
Email
));
}
}
}
}
tests_old/RecordTestCase.php
View file @
0dd85678
...
@@ -113,9 +113,9 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
...
@@ -113,9 +113,9 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$user
=
new
User
();
$user
=
new
User
();
$this
->
assertTrue
(
isset
(
$user
->
id
));
$this
->
assertTrue
(
!
isset
(
$user
->
id
));
$this
->
assertTrue
(
isset
(
$user
[
'id'
]));
$this
->
assertTrue
(
!
isset
(
$user
[
'id'
]));
$this
->
assertTrue
(
$user
->
contains
(
'id'
));
$this
->
assertTrue
(
!
$user
->
contains
(
'id'
));
}
}
public
function
testNotNullConstraint
()
public
function
testNotNullConstraint
()
...
...
tests_old/Relation/OneToOneTestCase.php
View file @
0dd85678
...
@@ -83,7 +83,7 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase
...
@@ -83,7 +83,7 @@ class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase
$this
->
assertTrue
(
$user
->
Email
instanceOf
Email
);
$this
->
assertTrue
(
$user
->
Email
instanceOf
Email
);
$user
->
Email
=
Doctrine_Null
::
$INSTANCE
;
$user
->
Email
=
Doctrine_Null
::
$INSTANCE
;
$user
->
save
();
$user
->
save
();
$this
->
assertTrue
(
$user
->
Email
instanceOf
Doctrine_N
ull
);
$this
->
assertTrue
(
$user
->
Email
===
n
ull
);
}
}
public
function
testSavingRelatedObjects
()
public
function
testSavingRelatedObjects
()
...
...
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