cake_1.2.0.7692_RC3 I think I've found a bug where 2 different elements are called on a page, each for different controllers, and each method uses a contain block in find conditions. I've just spent several hours trying to figure out why Containable was refusing to fetch data from a particular model, only to realise that it does work once I remove a previous element() call from the page.
I have gone through Trac to see if this is already been reported. Please excuse me if I missed it, as my head is pretty well spinning from trying to figure this out (and going through Containable line by line tonight). My guess is this is an unbinding issue, and there are some reports of that, but I'm really not sure if what I'm looking at on Trac is the same thing. Here's the lowdown: class AppModel extends Model { var $actsAs = array('Containable'); ... class User extends AppModel { var $name = 'User'; var $hasOne = array( 'Admin', 'Professional', 'Organisation' ); var $hasMany = array( 'Publication', 'Post' ); ... class Post extends AppModel { var $name = 'Post'; var $belongsTo = array('User', 'PostCategory'); ... class PostsController extends AppController { /* this method is called from an element */ function front_page() { $criteria = array( 'conditions' => array( 'OR' => array( 'Post.embargo IS NULL', 'Post.embargo < NOW()' ) ), 'limit' => 5, 'fields' => array( 'Post.id', 'Post.created', 'Post.user_id', 'Post.comments_enabled', 'Post.title', 'Post.intro', 'Post.body' ), 'contain' => array( 'PostCategory' => array( 'fields' => array('name') ), 'User' => array( 'Admin' => array( // <-- this is the model that doesn't get included in the query 'fields' => array( 'first_name', 'last_name' ) ) ) ) ); return $this->Post->find('all', $criteria); } Now, in home.ctp, I have 2 element() calls. One is for the method above, and the other is to PublicationsController. In that method, the $criteria is almost the same, except I'm getting Professional.first_name, etc. instead of Admin (well, and it's selecting publications, obviously). Whichever one comes first on the page works fine. The other one will get all the data for User, but not for Admin or Professional. If I switch the second one to come first, it works and the other one fails. So, I know my associations are all good. As I said, I tried to figure out if this was already on Trac but nothing jumped out at me. I'm just bloody thankful I removed thefirst element temporarily of I'd never have figured out what's been driving me freaking crazy for ... crap! 4 hours now. For anyone who understands Containable better than me, does this seem like something new? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---