On Wed, Feb 18, 2015 at 8:02 AM, Dmitry Stogov <dmi...@zend.com> wrote:

>
>
> On Wed, Feb 18, 2015 at 12:51 AM, guilhermebla...@gmail.com <
> guilhermebla...@gmail.com> wrote:
>
>> François,
>>
>> Doctrine relies on nested annotations for a variety of mapping
>> information.
>> One example:
>>
>>
>> http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapping.html#one-to-many-unidirectional-with-join-table
>>
>>
> Nested annotations are not going to be necessary, because they may be
> represented by PHP pseudo-syntax (and/or PHP array syntax)
>
> <Doctrine_Join(
>     ManyToMany($targetEntity="Phonenumber"),
>     JoinTable($name="users_phonenumbers",
>         $joinColumns=JoinColumn($name="user_id",
> $referencedColumnName="id"))
>     inverseJoinColumns=JoinColumn($name="phonenumber_id",
> $referencedColumnName="id", $unique=true))>
> class User {
>    ...
> }
>
> $r = new ReflectionClass("User");
> $ast = $r->getAnnotation("Doctine_Join");
> echo $ast->child[0]->child[0]; // "ManyToMany"
> echo $ast->child[0]->child[1]->child[0]->child[0]; // "$targetEntity"
>
> or If we provide API similar to SimpleXML
>
> echo $ast[0][0]; // "ManyToMany"
> echo $ast[0][1][0][0]; // "$targetEntity"
>
> Thanks. Dmitry.
>

nested can be done in any way, its a statement so the following would work:

<orm(new JoinTable(['joinColumns' => [new JoinColumn('id', 'other_id')]]))>

You might need to improve this by defining functions, so that "new
JoinTable" becomes just "JoinTable", but in any case we will find a way to
make it work in Doctrine.

>
>
>
>
>> []s,
>>
>> On Tue, Feb 17, 2015 at 4:33 PM, François Laupretre <franc...@php.net>
>> wrote:
>>
>>> Hi Alexander,
>>>
>>> > De : Alexander Lisachenko [mailto:lisachenko...@gmail.com]
>>> >
>>> > This RFC consists of two parts: parsing API and parser extension API.
>>> Last
>>> > one can be rejected, however it can be perfectly connected with
>>> annotation
>>> > RFC (if AST will be used as values)
>>>
>>> Parser extension API is great. Go on with it. I have a lot of uses in
>>> mind.
>>>
>>> > As for annotations, general use-case is appreciated. This can be
>>> extended
>>> > later in future versions of PHP. Therefore, annotation syntax should
>>> allow
>>> > to define key and values. Value can be valid expression (AST? concrete
>>> > node? compiled value?) or can recursively contain nested annotations.
>>>
>>> Can you give a use case for nested annotations ? I don't see what they
>>> can be needed for.
>>>
>>> Thanks
>>>
>>> François
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Guilherme Blanco
>> MSN: guilhermebla...@hotmail.com
>> GTalk: guilhermeblanco
>> Toronto - ON/Canada
>>
>
>

Reply via email to