The Hulme Ramblings of a web developer

27Oct/110

Models, Mappers and fetching

Tonight I decided to have a quick look into getting my head around models and the like.

I have decided in the end to go in format of having a DBTable model which will contain all getter and setter functions and table joins/relationships; and to have a "normal" model (extending the DBTable model) which will be used for all other functions related for that particular model. This probably isn't the right way to be doing it, or the best way. But I'm sure with time and more playing about with Zend Framework I will work it all out.

So for today I started off with making the album table, models, inserting dummy data and getting them to list in a view.

Then I moved on to making the image models and table.

At this point I'm starting to get to like the command line tool. Something Kohana could do with to make it a little bit better. But at this point I am still preferring Kohana.

Next it was trying to work out how to set up relationships in the models. Getting the Album model to have many images, and an image belonging to many albums. Time to dig my nose into the ZF wiki!  ... which ended up not making a lot of sense to me in my current tired state!

I did find to be what seems a godsend to help me understand what I am trying to found out here. Eventually I got my page to stop erroring. Turned out I was missing some row classes that wasn't made clear on the ZF Wiki. This gives me an idea of having a tutorial section explaining how to do this the way I got things working.

 

Conclusion

At the end of tonight I have managed to:

  • Set up Albums and Images Models
  • List all the albums and models in the database in a view
  • Create row models ready for relationship implementation
  • Set up a relationship between the two models

Pages I found useful:

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

Trackbacks are disabled.