Hi Robin,

What you are asking for is very platform specific, and very far from how
the ORM operates.

I suggest keeping it in native SQL.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 4 May 2015 at 15:31, Robin <[email protected]> wrote:

> I have a Postgresql db with a json column.
>
> Now I want to create the following query with DQL:
>
> select  *
> from    table_1 t, json_each(json_field) t2
> where   t2.value @> '{"v_id": "5544d28431feb"}';
>
>
> or
>
> select  *
> from    table_1
> cross join lateral
>         json_each(json_field) t2
> where   t2.value @> '{"v_id": "5544d28431feb"}';
>
>
> My current solution is to use a native query. I came up with that idea
> after writing this post. It works better than expected. However, If it
> would be possible with DQL with reasonable effort I'd like to use DQL.
>
>
>
> On Monday, May 4, 2015 at 3:59:39 PM UTC+2, Marco Pivetta wrote:
>>
>> Can you make a practical example of what you need? Doctrine2 only
>> supports entities and associations in the FROM clause
>> On May 4, 2015 08:27, "Robin" <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I was wondering if it is somehow possible to write a dql query like:
>>>
>>> SELECT e
>>> FROM Entity e, function(e.field) e2
>>>
>>> The documentation
>>> <http://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html#dql-select-clause>
>>>  states
>>> that:
>>>
>>>    - The FROM keyword is always followed by a *fully-qualified class
>>>    name* which in turn is followed by an identification variable or
>>>    alias for that class name. This class designates a root of our query from
>>>    which we can navigate further via joins (explained later) and path
>>>    expressions.
>>>
>>>
>>> Therefore, it seems that it would not be possible. Is there any chance
>>> to accomplish this? I would be fine if it would work after a JOIN
>>> expression as well.
>>>
>>> Best,
>>> Robin
>>>
>>> --
>>> 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 http://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 http://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 http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to