Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63321 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10413 invoked from network); 10 Oct 2012 12:34:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2012 12:34:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=bschussek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bschussek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.170 as permitted sender) X-PHP-List-Original-Sender: bschussek@gmail.com X-Host-Fingerprint: 209.85.223.170 mail-ie0-f170.google.com Received: from [209.85.223.170] ([209.85.223.170:46115] helo=mail-ie0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/93-23031-73B65705 for ; Wed, 10 Oct 2012 08:34:00 -0400 Received: by mail-ie0-f170.google.com with SMTP id c12so800432ieb.29 for ; Wed, 10 Oct 2012 05:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=dJQIZzoS/5BgLtLFb+pvhY9tyOa3CGKW2jOGgFdlJAA=; b=pvmFYkXLPv+OXP7G3OBttV+5xYEgPzh9uS6ziDc+MGlGV+mdDYhXX+TCMA/WRzejGZ qbkUw2iTF4pIcRHM8NvxueehSl+lXRcVhsL2WWRGQu51t2tYwzId0O/Glv0+Evf+3Lqh PU6tvrq7CnNS/7HoSt5CMA+eugsBruLROUYK/ehfkEEwql9ZdBQCIjDxg8qfyb6+Dyme 2z5TVWlZv8vTFuWejrgm+HplQ+ozJF8d67RC2mI0nCm1pB/LrBv9R3Y+X96P2dxqNkSL k1Cx5D7Gkq1vqVGoUDOTZ2NmMMjnU99uxpIGuusD+H2JfRFXxJKYnELXq+0842/XpTu5 DLNw== Received: by 10.50.88.165 with SMTP id bh5mr5064173igb.42.1349872434533; Wed, 10 Oct 2012 05:33:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.84.16 with HTTP; Wed, 10 Oct 2012 05:33:24 -0700 (PDT) In-Reply-To: <9570D903A3BECE4092E924C2985CE485612B4AE2@MBX202.domain.local> References: <9570D903A3BECE4092E924C2985CE485612B3B48@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B496D@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE485612B4AE2@MBX202.domain.local> Date: Wed, 10 Oct 2012 14:33:24 +0200 Message-ID: To: Clint Priest Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Propety Accessors v1.1 From: bschussek@gmail.com (Bernhard Schussek) 2012/10/10 Clint Priest : > While I agree it would be a "nice to have" it would also be un-necessary. There are already ways to do precisely what is desired here by way of ArrayAccess. > > class Addresses implements ArrayAccess { > offsetSet($offset, $value) { ... } > offsetGet() { ... } > offsetUnset($offset) { ... } > offsetExists($offset) { ... } > } This approach does not work for the use case I presented: class Addresses implements ArrayAccess { public function offsetSet($offset, $address) { $this->_Addresses[] = $address; $address->Contact = $contact; // where do we get the contact from? } } If we pass $contact to the Addresses instance, the class is bound to Contact and cannot be used anymore for different associations that * do not involve Contact * have a different arity (one-to-many: $address->Contact = $contact, many-to-many: $address->Contacts[] = $contact) Consequently, we would need to create a new collection class for each to-many association, which is neither pragmatic nor good OO design.