Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28620 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96865 invoked by uid 1010); 27 Mar 2007 20:55:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 96832 invoked from network); 27 Mar 2007 20:55:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Mar 2007 20:55:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=jeff@procata.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jeff@procata.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain procata.com from 207.58.169.145 cause and error) X-PHP-List-Original-Sender: jeff@procata.com X-Host-Fingerprint: 207.58.169.145 vps.procata.net Linux 2.4/2.6 Received: from [207.58.169.145] ([207.58.169.145:36084] helo=vps.procata.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9D/2D-13154-CA489064 for ; Tue, 27 Mar 2007 15:55:10 -0500 Received: from [65.111.214.160] (helo=[10.0.1.2]) by vps.procata.net with esmtp (Exim 4.63) (envelope-from ) id 1HWIh6-0005kx-U4 for internals@lists.php.net; Tue, 27 Mar 2007 16:55:06 -0400 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <46004829.7080200@pooteeweet.org> References: <1174134488.8667.33.camel@lena> <45FC74A5.6080307@pooteeweet.org> <1174231834.12274.110.camel@lena> <45FEBD70.2090000@zend.com> <1174330743.9134.2.camel@lena> <41721.216.230.84.67.1174341117.squirrel@www.l-i-e.com> <1174342387.14657.86.camel@lena> <46004829.7080200@pooteeweet.org> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: Content-Transfer-Encoding: 7bit Date: Tue, 27 Mar 2007 16:55:01 -0400 To: internals@lists.php.net X-Mailer: Apple Mail (2.752.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.procata.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - procata.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] google SoC - dbobj From: jeff@procata.com (Jeff Moore) Hi, Sorry, I'm coming to this discussion a bit late and perhaps I don't understand the all issues, but I think the scope of creating an ORM for PHP is probably too large. Let me suggest a smaller project that could lead to better ORM. PHP has several methods of serializing and unserializing objects to different formats: PHP serialization format using serialize/unserialize (with __sleep, __wakeup and the Serializable interface) PHP code using var_export and eval (with __set_state) JSON using json_encode and json_decode Partial support for DB Records using mysql_fetch_object or PDOStatement->fetchObject() Its safe to assume that other serialization formats are possible. All of these methods have to address the same issues with objects: How to handle protected and private properties? To call or bypass the constructor on unserialization? Can objects become involved with their own serialization? (such as __sleep, __wake, __set_state, and Serializable) Must objects become involved with their own serialization (such as with var_export and __set_state) or can you serialize unaware objects? Are object relationships and identity preserved? (only true for serialize/unserialize right now) How are classes loaded? (unserialize_callback_func and __autoload?) I think a more limited scope project would be to attempt to address these core object serialization issues across the multiple formats that PHP already provides in some consistent way. Of course, not every capability is possible or necessary with every format. Before implementing ORM in C, which would be relatively less flexible than a PHP implementation, perhaps it would be a good idea to profile the existing PHP ORM solutions and look for opportunities to implement key functions in C, while leaving the majority to user space. A possible example of such an opportunity might be some equivalent to extract() and compact() only for converting between arrays and object properties instead of arrays and local variables. Rather than implement a full blown ORM extension, perhaps implementing some object serialization enhancements would be a good alternative, or at least a good first step? Perhaps some user space ORM profiling would be a good way to find the second step? Best Regards, Jeff