Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-16-2008, 10:34 AM
mgordon's Avatar
Junior Member
 
Join Date: Sep 2007
Location: Stockholm, Sweden
Posts: 16
Send a message via Skype™ to mgordon
Post A quick and dirty ORM for 1.5

In 1.0 I've overloaded the _fetch method to join tables to create an ORM-like app. I only really need this in one place so I don't wan't to change my app to Doctrine.

What I have is in theory simpe:

Customer database - contains customer id
-- Company database - contains company specific data
-- Person database - contains person specific data

Since the customer id is the same this seems like a good way of doing it. All I do is a join() where the company or person data are stored in a different var which is then also searched when the __get, save etc methods are called. Worked nicely until the _fetch got fundamentally changed...

I've looked at different ORM proposals but all efforts seem to have died off...

Pleaze share with me your dirty hack on how to solve this until the devs come up with an orm.

Thanks!

Last edited by mgordon : 03-13-2008 at 01:01 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-17-2008, 08:39 PM
mgordon's Avatar
Junior Member
 
Join Date: Sep 2007
Location: Stockholm, Sweden
Posts: 16
Send a message via Skype™ to mgordon
Default

Ok, I've put together the attached class, not as quick as I hoped but pretty dirty. Got a little bigger than the max allowed txt...

This is my novice aproach to an ORM - Object-Relational mapping database object. Please give hints on howto make the class safer for future changes. Any hints are appreciated.

Last edited by mgordon : 02-24-2008 at 11:32 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-24-2008, 11:31 AM
mgordon's Avatar
Junior Member
 
Join Date: Sep 2007
Location: Stockholm, Sweden
Posts: 16
Send a message via Skype™ to mgordon
Smile Update to the table

So far u can only have inheriting tables but it seems to work nicely. See the .3 version.
Attached Files
File Type: zip OrmTable_v0.3.zip (6.0 KB, 21 views)

Last edited by mgordon : 03-13-2008 at 12:59 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-13-2008, 10:46 PM
Junior Member
 
Join Date: May 2008
Posts: 2
Default

Here is a tutorial/write up I did on a very simple ORM I wrote for 1.5

Zend_Db_Table with Normalized Tables Joshteam’s Weblog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:14 AM.