[ciapug] Symphony - peer classes
Tony Bibbs
tony at tonybibbs.com
Tue Oct 30 09:22:15 CDT 2007
Peer classes have all the meta data about the object so that Propel can do all the database interaction. If you open one up you'll see what I mean as it'll list the columns, data types, etc. What you *should* have is two Peer classes, one that is abstract and has all the meta data and another that is a stub. Then you should have a base class that is a pure PHP class with nothing but getters/setters on that class and then another stubbed out descendent.
The stubs are where you should put any custom code to avoid having your customization overwritten on subsequent builds. The basic recommendation is to put data access logic in the Peer stub and customer business logic in the other stub.
--Tony
----- Original Message ----
From: "carl-olsen at mchsi.com" <carl-olsen at mchsi.com>
To: ciapug at cialug.org
Sent: Tuesday, October 30, 2007 8:55:48 AM
Subject: [ciapug] Symphony - peer classes
I'm reading about Symfony and I've installed it on my desktop and on the web server. I'm on the chapter dealing with Object Relational Mapping (ORM), and it shows 8 classes being created for two tables in the database (blog_articles and blog_comments). It creates two base classes and two classes that inherit from them (where you add additional methods). It also shows two peer base classes and two peer classes that inherit from them. The only difference between the regular classes and the peer classes appears to be the method calls are static in the peer classes. The data layer uses propel and creole for the relational mapping.
Does anyone know what the peer classes do other than making it easier to write method calls in the code? Is that their main purpose?
Carl Olsen
Des Moines, IA
_______________________________________________
ciapug mailing list
ciapug at cialug.org
http://cialug.org/mailman/listinfo/ciapug
More information about the ciapug
mailing list