logo

Extra Iterations in Data Array (hasMany Mistake)

logo

Just a quick one today, if you find you are having to use nested Set::Extracts or nested foreach loops in your code to extract data then it is possible you have some incorrect associations.

For instance if you array looks like this:

Array  (     [0] => Array         ( Array (    [0] => Array         ( 

It is possible that you have a hasMany where you should have an hasOne or belongsTo association.

Share with your friends and help out this site:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogosphere News
  • E-mail this story to a friend!
  • Identi.ca
  • LinkedIn
  • Live
  • MisterWong
  • MySpace
  • Ping.fm
  • Reddit
  • RSS
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Tumblr
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
logo
logo
Powered by Nu Order Webs