SQL & OOP
Moderator: General Moderators
SQL & OOP
How do you combine SQL & OOP design principles with PHP? Joins in particular usually involve multiple tables, which means a class corresponding to a table has to know the SQL implementation of another class corresponding to a table.
Re: SQL & OOP
That's a big subject. Patterns of Enterprise Application Architecture has a ton of information on various design patterns which you can use - and when to use them. The link provides some brief summaries but the book explains everything in more detail.GameMusic wrote:How do you combine SQL & OOP design principles with PHP?
What is a link class?or you can use a link class between the tables..
I'm making a message board. There are tables for users, members, forums, topics, posts, etc. Most of the joins involve searching for data that matches a nested set tree. The main reason I want to separate SQL is because I want to be able to integrate it with CMS, galleries, etc.Why?
Thanks. Do any of the models in particular fit with a program that needs to use joins?That's a big subject. Patterns of Enterprise Application Architecture has a ton of information on various design patterns which you can use - and when to use them. The link provides some brief summaries but the book explains everything in more detail.
Maugrim talked about a separate data layer here. Can anybody recommend other online examples or tutorials displaying such a system in more detail?
- staniszczak
- Forum Newbie
- Posts: 13
- Joined: Wed Oct 05, 2005 1:39 pm
- Location: Radomsko, Poland
You can see it for example http://propel.phpdb.org/. It's one of many Object Relational Mapping (O/R Mapping) for PHP (Propel works only with PHP5).
Best regards,
Marcin Staniszczak
Best regards,
Marcin Staniszczak
- staniszczak
- Forum Newbie
- Posts: 13
- Joined: Wed Oct 05, 2005 1:39 pm
- Location: Radomsko, Poland
PHP have huge problem with include/require (_once and normal) files - you can check - it's one of more time expensive language constructions. It's main problem in PHP performance:-( And we must remember - PHP isn't Java (it's slow - many people thinks that Java is too slow, but it isn't true for now, Java require many memory, but today it isn't slow), but we always can work with Java (PHP / Java Integration or if we write commercial soft Zend Platform). But for fan, for studying, or if we have very speed dedicated server (or cluster with Zend Platform - it's offer for example share session information between Web Servers in a cluster) it's interested pattern.
Best regards,
Marcin Staniszczak
Best regards,
Marcin Staniszczak