Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83033 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54709 invoked from network); 18 Feb 2015 08:51:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 08:51:08 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.51 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.51 mail-yh0-f51.google.com Received: from [209.85.213.51] ([209.85.213.51:35040] helo=mail-yh0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/85-18888-A7254E45 for ; Wed, 18 Feb 2015 03:51:06 -0500 Received: by yhoc41 with SMTP id c41so1984854yho.2 for ; Wed, 18 Feb 2015 00:51:03 -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=TiqrR+URwu+GnI68BIYqviNrseMRGsf/oz8z+DGG3U0=; b=JO7Sak0k1vNJlaZnPwhctfr5/BIkeibdFSLDVC1U84OrZ00CO89s1vem1aToWzeDME 38gwpOKj+QywwvYdNilIdr0ss9nmg6K76fk8wud4zSIQ+1gYWV3EK3BbzbTLE3pNRi9Z uQ6C8UqIEqni+nzUzCUAVK0bvUyoyKXcgyPSqa3QjGizBOTTHmKAui0SE/QQTfgEez3G l8irqNbSdLYpb4ztJNtYHS8/WysRTkEgpDJKm5d2oS6ChS60XCKkx71t5ANkZqetBT0W o35g/QLM5TWjxQKiHbicEgRXBDyPRtGKQg9XZz6DYM8EUrGsnEtxlAT7OBNNRuRHcJwv 6BYw== X-Gm-Message-State: ALoCoQk7DcIKUVpi6ak69nLfkczP+fU/8z1ct/6f++peRjeSUskRtzVCUdhJAEKm5RHONZu+rIFYaGkunbLvuXO/9ZMhA+qXp4XIQ3cpktuLy26bxT+PZqj7URcD3dhUU7HxYaXGG5luQRqI7YNrg9lC1oCHlahCmA== MIME-Version: 1.0 X-Received: by 10.52.25.11 with SMTP id y11mr9651438vdf.51.1424249463582; Wed, 18 Feb 2015 00:51:03 -0800 (PST) Received: by 10.52.74.73 with HTTP; Wed, 18 Feb 2015 00:51:03 -0800 (PST) In-Reply-To: References: <02a101d04af9$507484f0$f15d8ed0$@php.net> Date: Wed, 18 Feb 2015 12:51:03 +0400 Message-ID: To: Benjamin Eberlei 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=001a1133e5f25947e2050f58eb6f Subject: Re: [PHP-DEV] Annotations in PHP7 From: dmitry@zend.com (Dmitry Stogov) --001a1133e5f25947e2050f58eb6f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Feb 18, 2015 at 11:05 AM, Benjamin Eberlei wrote: > > > 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-map= ping.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 wor= k: > > [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 t= o > make it work in Doctrine. > Are you (and Doctrine team) interested in this annotation idea? Thanks. Dmitry. > >> >> >> >>> []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? concre= te >>>> > 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 >>> >> >> > --001a1133e5f25947e2050f58eb6f--