Re: PHP database interface layer

From: Date: Thu, 22 Jul 2010 13:40:51 +0000
Subject: Re: PHP database interface layer
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-307091@lists.php.net to get a copy of this message
On 22 July 2010 15:35, Marc Guay <marc.guay@gmail.com> wrote: > Hi everyone, > > I've built a fairly large normalized database schema for a project. > This is fun for me as I like thinking about how everything is > interconnected.  Foreign keys are all set up, many-to-many tables are > go, etc, and so on.   But now it's time to create an interface between > that database and the website using PHP.  I've searched the web and > this is obviously a very common problem with many solutions, but I > can't help but feel that all of the logic I've built into the database > is worth nothing once I start coding.  I found this > article/presentation that essentially sums up my frustration: > http://mag-sol.com/talks/lpm/2006/orm/.  Up until now > I've been > working on smaller projects with only a few tables that don't really > relate to each other, and have found this tool > (http://www.ricocheting.com/code/php/mysql-database-class-wrapper) > very handy for the reasons he explains, but I'm looking for something > a little different.  I've looked at RedBean and it seems pretty handy, > but it also requires me to redefine all of the foreign keys I've > already defined, which is annoying.  Any hope of something like > > // Get company where name='Widgets Inc.' or id=1 or.... > $company = $db->get_company("name='Widgets Inc.'"); > > // Get all clients joined to the company > $clients = $company->get_clients(); > > // Get all projects joined to the client > $projects = $clients->get_projects(); > > ? > Have you looked at things like Doctrine2? Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 </hype>

« previous php.general (#307091) next »