Re: [fw-general] Zend_Db_Table How best to associate an object with a db table?
Thanks Cem, I am going to look at Zend_Db_Table_* classes for sure. I appreciate the guidance. And for everyone, I just read this article of Matthew's http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html and it is awesome. Thanks Matthew. On Mon, Apr 27, 2009 at 12:58 PM, Cem Derin wrote: > Zend_Db_Table (respective any inherited class) represents all users (the > full table). Zend_Db_Table_Row represents a single user (a single record). > > Thats how I use the Zend_Db_Table_*-Classes (and I extend them massively > without any problem). > > Cheers, > > Cem > > J DeBord schrieb: > >> Karol, I thought about using Zend_Db_Table_Row somehow. Would the Row >> object become a variable of the user class? Then if the User's attributes >> change, you would actually be changing the attributes of the Row object? >> This sounds great, I just don't have enough experience to know if this is >> the best way to go about it. >> >> Thanks a lot. >> >> J >> >> On Mon, Apr 27, 2009 at 10:13 AM, Karol Grecki > kgre...@gmail.com>> wrote: >> >> >>Jason, >> >>I suggest you use Zend_Db_Table to retrieve corresponding row and >>store it >>as a member variable (Zend_Db_Table_Row). You can expose its >>properties >>using __get/set for ease of use. Extending Zend_Db_Table would be >>a bad >>idea. >> >>Karol >> >> >>J DeBord wrote: >>> >>> This may be partially a general oop question, but I hope someone >>can give >>> me >>> some advice. >>> >>> If you want to build a User object, what is the best way to >>store it's >>> attributes? Would a user object extend a Zend_Db_Table? Would >>you code a >>> User class and have it interact with a UserTable extends >>Zend_Db_Table >>> class? Can anyone provide a general example of code please? Or >>any advice? >>> Books to read, sites to visit, etc... >>> >>> Thanks a lot. >>> >>> Jason DEBORD >>> Limoges, France >>> >>> http://www.jasondebord.net/ >>> >>> >> >>-- >>View this message in context: >> >> http://www.nabble.com/Zend_Db_Table-How-best-to-associate-an-object-with-a-db-table--tp23245110p23251895.html >>Sent from the Zend Framework mailing list archive at Nabble.com. >> >> >> >
Re: [fw-general] Zend_Db_Table How best to associate an object with a db table?
Karol, I thought about using Zend_Db_Table_Row somehow. Would the Row object become a variable of the user class? Then if the User's attributes change, you would actually be changing the attributes of the Row object? This sounds great, I just don't have enough experience to know if this is the best way to go about it. Thanks a lot. J On Mon, Apr 27, 2009 at 10:13 AM, Karol Grecki wrote: > > Jason, > > I suggest you use Zend_Db_Table to retrieve corresponding row and store it > as a member variable (Zend_Db_Table_Row). You can expose its properties > using __get/set for ease of use. Extending Zend_Db_Table would be a bad > idea. > > Karol > > > J DeBord wrote: > > > > This may be partially a general oop question, but I hope someone can give > > me > > some advice. > > > > If you want to build a User object, what is the best way to store it's > > attributes? Would a user object extend a Zend_Db_Table? Would you code a > > User class and have it interact with a UserTable extends Zend_Db_Table > > class? Can anyone provide a general example of code please? Or any > advice? > > Books to read, sites to visit, etc... > > > > Thanks a lot. > > > > Jason DEBORD > > Limoges, France > > > > http://www.jasondebord.net/ > > > > > > -- > View this message in context: > http://www.nabble.com/Zend_Db_Table-How-best-to-associate-an-object-with-a-db-table--tp23245110p23251895.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >
Re: [fw-general] Zend_Db_Table How best to associate an object with a db table?
Jason, I suggest you use Zend_Db_Table to retrieve corresponding row and store it as a member variable (Zend_Db_Table_Row). You can expose its properties using __get/set for ease of use. Extending Zend_Db_Table would be a bad idea. Karol J DeBord wrote: > > This may be partially a general oop question, but I hope someone can give > me > some advice. > > If you want to build a User object, what is the best way to store it's > attributes? Would a user object extend a Zend_Db_Table? Would you code a > User class and have it interact with a UserTable extends Zend_Db_Table > class? Can anyone provide a general example of code please? Or any advice? > Books to read, sites to visit, etc... > > Thanks a lot. > > Jason DEBORD > Limoges, France > > http://www.jasondebord.net/ > > -- View this message in context: http://www.nabble.com/Zend_Db_Table-How-best-to-associate-an-object-with-a-db-table--tp23245110p23251895.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Db_Table How best to associate an object with a db table?
J DeBord wrote: This may be partially a general oop question, but I hope someone can give me some advice. If you want to build a User object, what is the best way to store it's attributes? Would a user object extend a Zend_Db_Table? Would you code a User class and have it interact with a UserTable extends Zend_Db_Table class? Can anyone provide a general example of code please? Or any advice? Books to read, sites to visit, etc... Personally, I prefer not to extend Zend_Db_Table for models. Matthew has written about it previously. http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html You should follow Matthew's blog for tutorials, news and insight about Zend Framework. There's also a free book available on ZF - http://www.survivethedeepend.com/ -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net