Taken from the Doctrine documentation:

<?php
class User
{
    //...
    /**
     * @ManyToMany(targetEntity="Group")
     * @JoinTable(name="User_Group",
     *      joinColumns={@JoinColumn(name="User_id",
referencedColumnName="id")},
     *      inverseJoinColumns={@JoinColumn(name="Group_id",
referencedColumnName="id")}
     * )
     */
    private $groups;
    //...
}

Not that I'm a fan of it, but it provides a valid usecase. I'm sure
there are more.

Cheers,
Vladislav


On Wed, Jan 9, 2013 at 2:09 PM, Derick Rethans <der...@php.net> wrote:
> On Tue, 8 Jan 2013, Pierrick Charron wrote:
>
>> On 8 January 2013 03:55, Stas Malyshev <smalys...@sugarcrm.com> wrote:
>>
>> > On the contrary, plenty of implementations means there's a need in
>> > this functionality, and it might be a good idea to have one standard
>> > implementation if it can cover like 80% of use cases.
>
> Good luck with that! I've seen so many different syntaxes for docblock
> "annotations" out there that I doubt you can do this.
>
>> I agree, there is a need in this functionality, but all those userland
>> implementations were at the first place made because this
>> functionality was not part of the language. I think docblocks is not
>> the solution, doc blocks are just comments, and I would expect any
>> code to work the same way if I remove my comments.
>
> Actually, docblocks are handled by the parser. And whether "annotations"
> come in the form of such a docblock with a specific syntax, or without
> with a special new syntax outside of docblocks makes no difference at
> all.
>
> And really, nobody can convince me that we would need stuff like:
>
> @MyApp\Acl({
>     "allow"=@MyApp\Acl\Allow({"john"="read", "joe"="write"}),
>     "deny"=@OtherApp\Acl\Deny(default="*", log=true)
> })
>
> cheers,
> Derick
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to