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
1c919c7a
Commit
1c919c7a
authored
Aug 02, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added whereIn
parent
48481be4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
Abstract.php
lib/Doctrine/Query/Abstract.php
+29
-0
No files found.
lib/Doctrine/Query/Abstract.php
View file @
1c919c7a
...
...
@@ -71,6 +71,35 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate
}
return
$this
->
parseQueryPart
(
'where'
,
$where
,
true
);
}
/**
* whereIn
* adds IN condition to the query WHERE part
*
* @param string $expr
* @param mixed $params an array of parameters or a simple scalar
* @return Doctrine_Query
*/
public
function
whereIn
(
$params
=
array
())
{
if
(
is_array
(
$params
))
{
$this
->
_params
=
array_merge
(
$this
->
_params
,
$params
);
}
else
{
$this
->
_params
[]
=
$params
;
}
$a
=
array
();
foreach
(
$params
as
$k
=>
$value
)
{
if
(
$value
instanceof
Doctrine_Expression
)
{
$value
=
$value
->
getSql
();
unset
(
$values
[
$k
]);
}
else
{
$value
=
'?'
;
}
$a
[]
=
$value
;
}
$where
=
$expr
.
' IN ('
.
implode
(
', '
,
$a
)
.
')'
;
return
$this
->
parseQueryPart
(
'where'
,
$where
,
true
);
}
/**
* addGroupBy
* adds fields to the GROUP BY part of the query
...
...
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