Created
March 20, 2015 09:43
-
-
Save michellesanver/42f23fc77b6b9348435e to your computer and use it in GitHub Desktop.
Doctrine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//So this is how it looks like in composer, so I do believe I have the latest version: | |
"doctrine/orm": "~2.5@dev", | |
"doctrine/common": "~2.5@dev", | |
"doctrine/dbal": "dev-retry-logic as 2.5", | |
"doctrine/doctrine-bundle": "~1.2", | |
"doctrine/migrations": "~1.0@dev", | |
"doctrine/doctrine-migrations-bundle": "~2.1@dev", | |
//My issue is with the following code that generates the error Fatal error: | |
Call to undefined method Doctrine\ORM\QueryBuilder::insert() | |
<?php | |
$queryBuilder = $em->createQueryBuilder() | |
->insert('product_browse_view') | |
->values( | |
array( | |
'productId' => '?', | |
) | |
) | |
->setParameter(0, $id); | |
// Ideas what I am doing wrong is very helpful! Thank you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I came with the same problem. After investigation i figured out that the 2.5 Patch of doctrine/dbal recieved the insert() method, but not the 2.5 Patch of doctrine/orm (they have both own QueryBuilder classes). So the method is still not avaible through your code above.
But instead to use the insert method of doctrine/dbal, make use of "Persisting entities": http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#persisting-entities