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
Expand all
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
This diff is collapsed.
Click to expand it.
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