Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56881 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45796 invoked from network); 12 Dec 2011 04:34:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2011 04:34:59 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:62616] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/00-45706-17485EE4 for ; Sun, 11 Dec 2011 23:34:58 -0500 Received: by iafj26 with SMTP id j26so3212190iaf.29 for ; Sun, 11 Dec 2011 20:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=fVbvvkl7q/sVbb+ka6h5h57IRpRIdBF6FNPz43Z9/+U=; b=VqbcQ+tfnPZshwv6ivB+BBThR5JtaJqPKK/VKn3NnEJQzEme5Sp7tOnDzJqdk2O403 3L+WplhzHh3N/NF4JQYx0dFHmq8yGr7TfB9wt7qO3VAhtScHNYfm76jyev5VEWMUxI0/ ctEwHG1yiLqnZZtuybRRAGb3Ys3Eq5r+wJEZ8= Received: by 10.182.41.69 with SMTP id d5mr2529488obl.47.1323664495215; Sun, 11 Dec 2011 20:34:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.77.194 with HTTP; Sun, 11 Dec 2011 20:34:34 -0800 (PST) In-Reply-To: References: <9570D903A3BECE4092E924C2985CE485399554D7@MBX202.domain.local> <7070130643313812382@unknownmsgid> <9570D903A3BECE4092E924C2985CE4853995589C@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE48539955910@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE4853995598C@MBX202.domain.local> Date: Sun, 11 Dec 2011 23:34:34 -0500 Message-ID: To: Will Fitch Cc: Clint M Priest , Pierre Joye , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Accessors v2 Patch From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") hi Will, That's what I've been thinking about. I have a special necessity to overload a class in a Proxy implementation (an instance that wraps a real Entity), demanding the load when any getter is active. This implementation seems to fit perfectly my needs, while still be cleanin= g. I wonder if the user have already implemented a getter in this approach, how can I overload this one? Example: class Foo { protected $name { get { return $this->name; } set { $this->name =3D $value; } } // ... } class FooProxy extends Foo { protected $name { get { $this->__load(); parent::get(); } set { $this->__load(); parent::set($value); } } // ... } How would it act in this situation? Cheers, On Sun, Dec 11, 2011 at 10:18 PM, Will Fitch wrote: > This approach, in theory, is an interceptor itself. =C2=A0Most use-cases = around this approach will be changing or augmenting an existing property th= at is not public. =C2=A0If you wanted to modify this interception, you'd ne= ed to extend the class using it and redefine the getter and/or setter. > > > On Dec 11, 2011, at 10:02 PM, guilhermeblanco@gmail.com wrote: > >> I have just one question, partially unrelated. >> >> How can I make something similar to Interceptors of Java according to >> your approach? >> For those that have no idea, interceptors is a way to intercept >> get/set of a property inside the class and act under this >> circumstance. >> >> []s, >> >> On Sun, Dec 11, 2011 at 8:01 PM, Clint M Priest wr= ote: >>> To be complete I should probably add something to the reflection system= as well. =C2=A0At present the getters/setters would show up as functions. >>> >>> What would be preferable? >>> 1) Show up as regular functions and let users fend for themselves? >>> 2) Hide from getMethods() and: >>> =C2=A02.1) Provide getAccessors() - Probably returning a new Reflection= PropertyAccessor class? >>> =C2=A02.2) Provide getGetters(), getSetters() >>> 3) Modify ReflectionProperty to include hasGetter() and hasSetter() >>> >>> Comments? >>> >>> -----Original Message----- >>> From: Pierre Joye [mailto:pierre.php@gmail.com] >>> Sent: Sunday, December 11, 2011 6:47 PM >>> To: Clint M Priest >>> Cc: internals@lists.php.net >>> Subject: Re: [PHP-DEV] Accessors v2 Patch >>> >>> oh right, I missed them. Yes, so it is covered as well :) >>> >>> On Mon, Dec 12, 2011 at 1:42 AM, Clint M Priest w= rote: >>>> There are already two tests against private read and private write, sh= ould I add two for protected as well? >>> >>> Cheers, >>> -- >>> Pierre >>> >>> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> >> >> -- >> Guilherme Blanco >> MSN: guilhermeblanco@hotmail.com >> GTalk: guilhermeblanco >> Toronto - ON/Canada >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> > --=20 Guilherme Blanco MSN: guilhermeblanco@hotmail.com GTalk: guilhermeblanco Toronto - ON/Canada