[ciapug] Symphony - peer classes

carl-olsen at mchsi.com carl-olsen at mchsi.com
Tue Oct 30 09:36:19 CDT 2007


I haven't actually generated anything yet.  I'm still just reading.  I'll be generating some tables and classes soon, so I'll take a look at them when I get that far.

I had to delete my Subversion repository and start over so I could get everything syncronized to run in both Zend Studio and Eclipse.  I have everything working in Zend Studio, and I think it will be okay in Eclipse, but I'm still experimenting.

Thanks!

Carl

-------------- Original message ----------------------
From: Tony Bibbs <tony at tonybibbs.com>
>
> 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
> 
> 
> 
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug




More information about the ciapug mailing list