Gosh, then why the error? I'm even more confused now if it should work. 
 Can you please write an example of how to do it not using querybuilder? Or 
perhaps an example of what you are talking about. 

Evan


On Thursday, June 30, 2016 at 6:21:20 PM UTC-5, Marco Pivetta wrote:
>
> If it's the DBAL query builder, then it should just work. I wouldn't use 
> the query builder though, as you don't really get any abstraction from it 
> with this kind of query (unless you need some dynamic bits in it)
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>
> On 30 June 2016 at 20:54, Evan Young <[email protected] <javascript:>> 
> wrote:
>
>> Ok, so I can't do a subquery in the FROM clause, so how do I do it then? 
>> This is DBAL querybuilder. 
>>
>> $this->connection = 
>> Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
>>
>>
>> This is where the $queryBuilder comes from:
>>
>> private $queryBuilder;
>>
>> function __construct($aQueryBuilder)
>> {
>>  $this->queryBuilder = $aQueryBuilder;
>>
>> }
>>
>>
>>
>>
>> On Thursday, June 30, 2016 at 8:12:02 AM UTC-5, Marco Pivetta wrote:
>>>
>>> What is `$this->queryBuilder`? Seems like you are calling it on a string?
>>>
>>> Also, subqueries are not supported in the `FROM` clause. Is this the ORM 
>>> query builder, or the DBAL one (SQL based)?
>>>
>>> Marco Pivetta 
>>>
>>> http://twitter.com/Ocramius      
>>>
>>> http://ocramius.github.com/
>>>
>>> On 30 June 2016 at 15:10, Evan Young <[email protected]> wrote:
>>>
>>>>
>>>>
>>>> On Thursday, June 30, 2016 at 1:54:57 AM UTC-5, Evan Young wrote:
>>>>>
>>>>> I'm a fairly newbie to Doctrine. I've run into a query that I can't 
>>>>> find any tutorials or answers on how to perform it through querybuilder. 
>>>>> Any assistance would be so very much appreciated. Here is my sql 
>>>>> query that I'm trying to perform: 
>>>>>  SELECT COUNT(mwl.IDENTIFIER) FROM (SELECT MOVIE_ID, PERSON_ID, 
>>>>> IDENTIFIER, MAX( TIMESTAMP ) FROM MOVIE_WATCHLIST WHERE MOVIE_ID = 2 
>>>>> OR MOVIE_ID = 3 or MOVIE_ID = 0 GROUP BY PERSON_ID) AS mwl LEFT JOIN 
>>>>> PERSON p ON mwl.PERSON_ID = p.IDENTIFIER WHERE p.MOVIE_CODE_FAVORITE = 
>>>>> 1 OR p.MOVIE_CODE_FAVORITE = 2
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> This does not work:
>>>>>
>>>>> $this->queryBuilder
>>>>>  ->select("COUNT('mwl.IDENTIFIER')")
>>>>>  ->from("(SELECT MOVIE_ID, PERSON_ID, IDENTIFIER, MAX( TIMESTAMP ) FROM 
>>>>> MOVIE_WATCHLIST WHERE MOVIE_ID = 2 OR MOVIE_ID = 3 or MOVIE_ID = 0 GROUP 
>>>>> BY PERSON_ID)", "mwl")
>>>>>  ->leftJoin("p", "PERSON", "mwl", "mwl.PERSON_ID = p.IDENTIFIER")
>>>>>  ->where("p.MOVIE_CODE_FAVORITE = 1")
>>>>>  ->andWhere("p.MOVIE_CODE_FAVORITE = 2");
>>>>>
>>>>> This is the error that I get:
>>>>>
>>>>> Fatal error: Call to a member function select() on string
>>>>>
>>>>>
>>>> Here is the full Stacktrace, which just shows the page that calls the 
>>>> database function and the database function page that calls the actual 
>>>> function that throws the error:
>>>>
>>>> Call Stack
>>>> #TimeMemoryFunctionLocation
>>>> 1 0.0010 130376 {main}( ) ...\dashboard.php*:*0
>>>> 2 0.0750 518368 database_access->movieObtained( ) ...\dashboard.php*:*
>>>> 70
>>>> 3 0.0751 519632 movAdmin->movieObtained( ) ...\dba.php*:*273
>>>>  
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "doctrine-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/doctrine-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "doctrine-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to