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
af2a8348
Commit
af2a8348
authored
Sep 02, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored parameter stacking (Fixes #442).
parent
0fdb2290
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
27 deletions
+28
-27
Hydrate.php
lib/Doctrine/Hydrate.php
+12
-10
Query.php
lib/Doctrine/Query.php
+1
-1
Abstract.php
lib/Doctrine/Query/Abstract.php
+13
-13
Record.php
lib/Doctrine/Record.php
+1
-1
Abstract.php
lib/Doctrine/Record/Abstract.php
+1
-1
run.php
tests/run.php
+0
-1
No files found.
lib/Doctrine/Hydrate.php
View file @
af2a8348
...
...
@@ -70,7 +70,9 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
/**
* @var array $params query input parameters
*/
protected
$_params
=
array
();
protected
$_params
=
array
(
'where'
=>
array
(),
'set'
=>
array
(),
'having'
=>
array
());
/**
* @var Doctrine_Connection $conn Doctrine_Connection object
*/
...
...
@@ -688,7 +690,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
*/
public
function
getParams
()
{
return
$this
->
_params
;
return
array_merge
(
$this
->
_params
[
'set'
],
$this
->
_params
[
'where'
],
$this
->
_params
[
'having'
])
;
}
/**
* setParams
...
...
@@ -751,7 +753,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
}
public
function
_execute
(
$params
)
{
$params
=
$this
->
_conn
->
convertBooleans
(
array_merge
(
$this
->
_params
,
$params
)
);
$params
=
$this
->
_conn
->
convertBooleans
(
$params
);
if
(
!
$this
->
_view
)
{
$query
=
$this
->
getQuery
(
$params
);
...
...
@@ -783,6 +785,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
*/
public
function
execute
(
$params
=
array
(),
$hydrationMode
=
null
)
{
$params
=
array_merge
(
$this
->
_params
[
'set'
],
$this
->
_params
[
'where'
],
$this
->
_params
[
'having'
],
$params
);
if
(
$this
->
_cache
)
{
$cacheDriver
=
$this
->
getCacheDriver
();
...
...
@@ -1036,10 +1040,9 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$oneToOne
=
false
;
$index
=
$driver
->
search
(
$element
,
$array
);
if
(
$index
===
false
)
{
$key
=
$map
[
'map'
];
if
(
isset
(
$key
))
{
if
(
$index
===
false
)
{
if
(
isset
(
$map
[
'map'
]))
{
$key
=
$map
[
'map'
];
if
(
isset
(
$array
[
$key
]))
{
throw
new
Doctrine_Hydrate_Exception
(
"Couldn't hydrate. Found non-unique key mapping."
);
}
...
...
@@ -1081,9 +1084,8 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable
$index
=
$driver
->
search
(
$element
,
$prev
[
$parent
][
$componentAlias
]);
if
(
$index
===
false
)
{
$key
=
$map
[
'map'
];
if
(
isset
(
$key
))
{
if
(
isset
(
$map
[
'map'
]))
{
$key
=
$map
[
'map'
];
if
(
isset
(
$prev
[
$parent
][
$componentAlias
][
$key
]))
{
throw
new
Doctrine_Hydrate_Exception
(
"Couldn't hydrate. Found non-unique key mapping."
);
}
...
...
lib/Doctrine/Query.php
View file @
af2a8348
...
...
@@ -1519,7 +1519,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$params
=
array
(
$params
);
}
// append parameters
$params
=
array_merge
(
$this
->
_params
,
$params
);
$params
=
array_merge
(
$this
->
_params
[
'where'
],
$this
->
_params
[
'having'
]
,
$params
);
$results
=
$this
->
getConnection
()
->
fetchAll
(
$q
,
$params
);
...
...
lib/Doctrine/Query/Abstract.php
View file @
af2a8348
...
...
@@ -65,9 +65,9 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
public
function
addWhere
(
$where
,
$params
=
array
())
{
if
(
is_array
(
$params
))
{
$this
->
_params
=
array_merge
(
$this
->
_params
,
$params
);
$this
->
_params
[
'where'
]
=
array_merge
(
$this
->
_params
[
'where'
]
,
$params
);
}
else
{
$this
->
_params
[]
=
$params
;
$this
->
_params
[
'where'
][
]
=
$params
;
}
return
$this
->
parseQueryPart
(
'where'
,
$where
,
true
);
}
...
...
@@ -93,7 +93,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
$a
[]
=
$value
;
}
$this
->
_params
=
array_merge
(
$this
->
_params
,
$params
);
$this
->
_params
[
'where'
]
=
array_merge
(
$this
->
_params
[
'where'
]
,
$params
);
$where
=
$expr
.
' IN ('
.
implode
(
', '
,
$a
)
.
')'
;
...
...
@@ -121,9 +121,9 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
public
function
addHaving
(
$having
,
$params
=
array
())
{
if
(
is_array
(
$params
))
{
$this
->
_params
=
array_merge
(
$this
->
_params
,
$params
);
$this
->
_params
[
'having'
]
=
array_merge
(
$this
->
_params
[
'having'
]
,
$params
);
}
else
{
$this
->
_params
[]
=
$params
;
$this
->
_params
[
'having'
][
]
=
$params
;
}
return
$this
->
parseQueryPart
(
'having'
,
$having
,
true
);
}
...
...
@@ -217,9 +217,9 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
}
else
{
if
(
$params
!==
null
)
{
if
(
is_array
(
$params
))
{
$this
->
_params
=
array_merge
(
$this
->
_params
,
$params
);
$this
->
_params
[
'set'
]
=
array_merge
(
$this
->
_params
[
'set'
]
,
$params
);
}
else
{
$this
->
_params
[]
=
$params
;
$this
->
_params
[
'set'
][
]
=
$params
;
}
}
return
$this
->
parseQueryPart
(
'set'
,
$key
.
' = '
.
$value
,
true
);
...
...
@@ -279,11 +279,11 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/
public
function
where
(
$where
,
$params
=
array
())
{
//$this->_params
= array();
$this
->
_params
[
'where'
]
=
array
();
if
(
is_array
(
$params
))
{
$this
->
_params
=
$params
;
$this
->
_params
[
'where'
]
=
$params
;
}
else
{
$this
->
_params
[]
=
$params
;
$this
->
_params
[
'where'
][
]
=
$params
;
}
return
$this
->
parseQueryPart
(
'where'
,
$where
);
...
...
@@ -298,11 +298,11 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
*/
public
function
having
(
$having
,
$params
=
array
())
{
$this
->
_params
=
array
();
$this
->
_params
[
'having'
]
=
array
();
if
(
is_array
(
$params
))
{
$this
->
_params
=
$params
;
$this
->
_params
[
'having'
]
=
$params
;
}
else
{
$this
->
_params
[]
=
$params
;
$this
->
_params
[
'having'
][
]
=
$params
;
}
return
$this
->
parseQueryPart
(
'having'
,
$having
);
...
...
lib/Doctrine/Record.php
View file @
af2a8348
...
...
@@ -139,7 +139,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
$class
=
get_class
(
$this
);
// get the table of this class
$this
->
_table
=
Doctrine_Manager
::
getInstance
()
->
getTable
(
get_class
(
$this
)
);
->
getTable
(
$class
);
$exists
=
false
;
}
...
...
lib/Doctrine/Record/Abstract.php
View file @
af2a8348
...
...
@@ -110,7 +110,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access
$conn
=
$this
->
_table
->
getConnection
();
foreach
(
$map
as
$key
=>
$value
)
{
$table
=
$conn
->
getTable
(
$key
);
//
$table->setOption('inheritanceMap', $value);
$table
->
setOption
(
'inheritanceMap'
,
$value
);
}
}
...
...
tests/run.php
View file @
af2a8348
...
...
@@ -74,7 +74,6 @@ $test->addTestCase(new Doctrine_Ticket330_TestCase());
$test
->
addTestCase
(
new
Doctrine_TicketNjero_TestCase
());
// Connection drivers (not yet fully tested)
$test
->
addTestCase
(
new
Doctrine_Connection_Pgsql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Connection_Oracle_TestCase
());
...
...
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