Allow passing empty arrays as parameters #264

Merged
merged 1 commit into from Apr 1, 2013

Conversation

Projects
None yet
4 participants
Contributor

frosas commented Jan 31, 2013

Right now something like

$entityManager
    ->createQuery("SELECT e FROM Entity e WHERE e IN (:entities)")
    ->execute(array('entities' => array()));

produces a Warning: array_fill(): Number of elements must be positive

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-435

@stof stof commented on the diff Jan 31, 2013

lib/Doctrine/DBAL/SQLParserUtils.php
@@ -130,11 +130,11 @@ static public function expandListParameters($query, $params, $types)
$types = array_merge(
array_slice($types, 0, $needle),
- array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET), // array needles are at PDO::PARAM_* + 100
@stof

stof Jan 31, 2013

Member

Please keep the comment

@frosas

frosas Jan 31, 2013

Contributor

Isn't the constant docblock enough? Also there is another place were the constant is used without any comment.

beberlei merged commit bf4e843 into doctrine:master Apr 1, 2013

1 check failed

default The Travis build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment