Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83031 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48960 invoked from network); 18 Feb 2015 08:05:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 08:05:40 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.212.173 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:53854] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/A4-18888-2D744E45 for ; Wed, 18 Feb 2015 03:05:39 -0500 Received: by mail-wi0-f173.google.com with SMTP id bs8so39075250wib.0 for ; Wed, 18 Feb 2015 00:05:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=KAOc//etj/3GUX/8PrIUnUs9Z4fzkf4G+qCOuotwR5Y=; b=NBVleS7gMo3l5jJh9bkC9Ash3rb3x78VBaf+vHvqiT5jOWptAAk2yJj2Au+LXRQjiY W5kUjOPt7cvUVQj9nly5v0/83B2XV+TyN9UfYpe8259CG8pS0KiIVYtst+fboQT7Hyo8 5NXhk7hDmzYJD9m9JVo9E/3bgByIBQ1HxOBTXTfMM8AlgxfO8EXJA7i30EzOrMzU6RG6 R8RK630/OQnbfA7fW4Ltk96e5ZjbCZOGipvmDOw/hbDUICsRr41rYjqBk9Ot4Xs35Rn+ mPncGiq1bieCSgfG6+ZIU6nnQpduRsH0B4rdoiesWpKy2AgDkJ13b++J7YS9031hFnh7 O2xg== X-Gm-Message-State: ALoCoQlD6oqnnXgqC4IP/+B/uefhjDFCDxQRxCTQX+r8D8YRmsXzqKBjWjdyUgLT+ErQWsUJWvhT MIME-Version: 1.0 X-Received: by 10.180.211.235 with SMTP id nf11mr2494617wic.52.1424246735198; Wed, 18 Feb 2015 00:05:35 -0800 (PST) Received: by 10.194.192.202 with HTTP; Wed, 18 Feb 2015 00:05:35 -0800 (PST) X-Originating-IP: [77.11.88.250] In-Reply-To: References: <02a101d04af9$507484f0$f15d8ed0$@php.net> Date: Wed, 18 Feb 2015 09:05:35 +0100 Message-ID: To: Dmitry Stogov Cc: "guilhermeblanco@gmail.com" , francois , Alexander Lisachenko , Nikita Popov , PHP Internals , Pierrick CHARRON , Pierre Joye , Zeev Suraski , Andi Gutmans , Joe Watkins , Yasuo Ohgaki , Sebastian Bergmann , Stanislav Malyshev , Rasmus Lerdorf Content-Type: multipart/alternative; boundary=001a11c38910b972a1050f5848bb Subject: Re: [PHP-DEV] Annotations in PHP7 From: kontakt@beberlei.de (Benjamin Eberlei) --001a11c38910b972a1050f5848bb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Feb 18, 2015 at 8:02 AM, Dmitry Stogov wrote: > > > On Wed, Feb 18, 2015 at 12:51 AM, guilhermeblanco@gmail.com < > guilhermeblanco@gmail.com> wrote: > >> Fran=C3=A7ois, >> >> Doctrine relies on nested annotations for a variety of mapping >> information. >> One example: >> >> >> http://doctrine-orm.readthedocs.org/en/latest/reference/association-mapp= ing.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) > > ManyToMany($targetEntity=3D"Phonenumber"), > JoinTable($name=3D"users_phonenumbers", > $joinColumns=3DJoinColumn($name=3D"user_id", > $referencedColumnName=3D"id")) > inverseJoinColumns=3DJoinColumn($name=3D"phonenumber_id", > $referencedColumnName=3D"id", $unique=3Dtrue))> > class User { > ... > } > > $r =3D new ReflectionClass("User"); > $ast =3D $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: [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=C3=A7ois Laupretre >> wrote: >> >>> Hi Alexander, >>> >>> > De : Alexander Lisachenko [mailto:lisachenko.it@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? concret= e >>> > 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=C3=A7ois >>> >>> >>> >>> >> >> >> -- >> Guilherme Blanco >> MSN: guilhermeblanco@hotmail.com >> GTalk: guilhermeblanco >> Toronto - ON/Canada >> > > --001a11c38910b972a1050f5848bb--