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
43e35d3b
Commit
43e35d3b
authored
Sep 12, 2008
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved hydration stuff
parent
bfff430e
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
423 deletions
+34
-423
Hydrator.php
lib/Doctrine/Hydrator.php
+0
-404
HydrationException.php
lib/Doctrine/ORM/Exceptions/HydrationException.php
+13
-0
AbstractHydrator.php
lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
+3
-1
ArrayDriver.php
lib/Doctrine/ORM/Internal/Hydration/ArrayDriver.php
+2
-2
Exception.php
lib/Doctrine/ORM/Internal/Hydration/Exception.php
+0
-0
ObjectDriver.php
lib/Doctrine/ORM/Internal/Hydration/ObjectDriver.php
+1
-1
StandardHydrator.php
lib/Doctrine/ORM/Internal/Hydration/StandardHydrator.php
+5
-5
Query.php
lib/Doctrine/Query.php
+1
-1
BasicHydrationTest.php
tests/Orm/Hydration/BasicHydrationTest.php
+9
-9
No files found.
lib/Doctrine/Hydrator.php
deleted
100644 → 0
View file @
bfff430e
This diff is collapsed.
Click to expand it.
lib/Doctrine/ORM/Exceptions/HydrationException.php
0 → 100644
View file @
43e35d3b
<?php
class
Doctrine_ORM_Exceptions_HydrationException
extends
Doctrine_ORM_Exceptions_ORMException
{
public
static
function
nonUniqueResult
()
{
return
new
self
(
"The result returned by the query was not unique."
);
}
}
?>
\ No newline at end of file
lib/Doctrine/
Hydrator/Abstract
.php
→
lib/Doctrine/
ORM/Internal/Hydration/AbstractHydrator
.php
View file @
43e35d3b
...
...
@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal::Hydration;
/**
* Base class for all hydrators (ok, we got only 1 currently).
*
...
...
@@ -29,7 +31,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
abstract
class
Doctrine_
Hydrator_Abstract
abstract
class
Doctrine_
ORM_Internal_Hydration_AbstractHydrator
{
/**
* @var array $_queryComponents
...
...
lib/Doctrine/
Hydrator
/ArrayDriver.php
→
lib/Doctrine/
ORM/Internal/Hydration
/ArrayDriver.php
View file @
43e35d3b
...
...
@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
#namespace Doctrine::ORM::Internal
::Hydration
;
/**
* Defines an array hydration strategy.
...
...
@@ -31,7 +31,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class
Doctrine_
Hydrator
_ArrayDriver
class
Doctrine_
ORM_Internal_Hydration
_ArrayDriver
{
/**
...
...
lib/Doctrine/
Hydrator
/Exception.php
→
lib/Doctrine/
ORM/Internal/Hydration
/Exception.php
View file @
43e35d3b
File moved
lib/Doctrine/
Hydrator/Record
Driver.php
→
lib/Doctrine/
ORM/Internal/Hydration/Object
Driver.php
View file @
43e35d3b
...
...
@@ -30,7 +30,7 @@
* @author Roman Borschel <roman@code-factory.org>
* @todo Rename to ObjectDriver
*/
class
Doctrine_
Hydrator_Record
Driver
class
Doctrine_
ORM_Internal_Hydration_Object
Driver
{
/** Collections initialized by the driver */
protected
$_collections
=
array
();
...
...
lib/Doctrine/
HydratorNew
.php
→
lib/Doctrine/
ORM/Internal/Hydration/StandardHydrator
.php
View file @
43e35d3b
...
...
@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
#namespace Doctrine::ORM::Internal
::Hydration
;
/**
* The hydrator has the tedious to process result sets returned by the database
...
...
@@ -56,7 +56,7 @@
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
*/
class
Doctrine_
HydratorNew
extends
Doctrine_Hydrator_Abstract
class
Doctrine_
ORM_Internal_Hydration_StandardHydrator
extends
Doctrine_ORM_Internal_Hydration_AbstractHydrator
{
/**
* Parses the data returned by statement object.
...
...
@@ -97,9 +97,9 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
$this
->
_queryComponents
=
$parserResult
->
getQueryComponents
();
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_ARRAY
)
{
$driver
=
new
Doctrine_
Hydrator
_ArrayDriver
();
$driver
=
new
Doctrine_
ORM_Internal_Hydration
_ArrayDriver
();
}
else
{
$driver
=
new
Doctrine_
Hydrator_Record
Driver
(
$this
->
_em
);
$driver
=
new
Doctrine_
ORM_Internal_Hydration_Object
Driver
(
$this
->
_em
);
}
$s
=
microtime
(
true
);
...
...
@@ -148,7 +148,7 @@ class Doctrine_HydratorNew extends Doctrine_Hydrator_Abstract
if
(
$hydrationMode
==
Doctrine
::
HYDRATE_SINGLE_SCALAR
)
{
$result
=
$stmt
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
if
(
count
(
$result
)
>
1
||
count
(
$result
[
0
])
>
1
)
{
throw
Doctrine_
Hydrator_
Exception
::
nonUniqueResult
();
throw
Doctrine_
ORM_Exceptions_Hydration
Exception
::
nonUniqueResult
();
}
return
array_shift
(
$this
->
_gatherScalarRowData
(
$result
[
0
],
$cache
));
}
...
...
lib/Doctrine/Query.php
View file @
43e35d3b
...
...
@@ -96,7 +96,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract
public
function
__construct
(
Doctrine_EntityManager
$entityManager
)
{
$this
->
_entityManager
=
$entityManager
;
$this
->
_hydrator
=
new
Doctrine_Hydrator
(
$entityManager
);
$this
->
_hydrator
=
new
Doctrine_
ORM_Internal_Hydration_Standard
Hydrator
(
$entityManager
);
$this
->
free
();
}
...
...
tests/Orm/Hydration/BasicHydrationTest.php
View file @
43e35d3b
...
...
@@ -71,7 +71,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
));
...
...
@@ -158,7 +158,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
,
true
));
...
...
@@ -254,7 +254,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
,
true
));
...
...
@@ -347,7 +347,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
,
true
));
...
...
@@ -487,7 +487,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
,
true
));
...
...
@@ -662,7 +662,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
,
true
));
...
...
@@ -827,7 +827,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
$hydrationMode
));
...
...
@@ -918,7 +918,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
);
$stmt
=
new
Doctrine_HydratorMockStatement
(
$resultSet
);
$hydrator
=
new
Doctrine_
HydratorNew
(
$this
->
_em
);
$hydrator
=
new
Doctrine_
ORM_Internal_Hydration_StandardHydrator
(
$this
->
_em
);
if
(
$name
==
'result1'
)
{
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
...
...
@@ -933,7 +933,7 @@ class Orm_Hydration_BasicHydrationTest extends Doctrine_OrmTestCase
$result
=
$hydrator
->
hydrateResultSet
(
$this
->
_createParserResult
(
$stmt
,
$queryComponents
,
$tableAliasMap
,
Doctrine
::
HYDRATE_SINGLE_SCALAR
));
$this
->
fail
();
}
catch
(
Doctrine_
Hydrator_
Exception
$ex
)
{}
}
catch
(
Doctrine_
ORM_Exceptions_Hydration
Exception
$ex
)
{}
}
}
...
...
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