Wednesday, August 25, 2010

Re: Problem loading intermediate model

var $uses =array('StepsUser','Question','QuestionsUser', 'Step');

I solved the problem doing

var $uses =array('QuestionsUser','StepsUser','Question', 'Step');

I'm not shure why this happened, but none of this models (StepsUser, Question, Step) has access to QuestionsUser table. In app controller:
var $uses = array('User');

User has access to QuestionsUser table (User has many Questions), I think QuestionsUser object is instanciated when User model is loaded, changing de order somehow solved the problem.

2010/8/25 Hugo M <ham1988@gmail.com>
Hi!, this is the file:

app/models/questions_user.php

<?php
class QuestionsUser extends AppModel {
    var $belongsTo = array('Answer', 'Question');
}
?>


2010/8/24 Sam <sam@masterscommission360.com>

rename questions_users.php to questions_user.php.

On Aug 24, 2:28 pm, "j.blotus" <j.blo...@gmail.com> wrote:
> please dump the contents of your model file, and the name of the file
> for us
>
> On Aug 24, 2:17 pm, Hugo M <ham1...@gmail.com> wrote:
>
>
>
> > No, I don't get missing table error :S. Table exists (questions_users). You
> > can work with your model without creating a model file thanks to Cake
> > automagic. But if the file is created, Cake loads the model from the file.
> > Well... that is not working for me (with this model) :(
>
> > 2010/8/24 j.blotus <j.blo...@gmail.com>
>
> > > Do you get a missing table error?
>
> > > Often these errors can be caused by incorrect file naming or class
> > > naming.
>
> > > On Aug 24, 12:03 pm, Hugo M <ham1...@gmail.com> wrote:
> > > > I have a model QuestionsUser that has some relationships (belongsTo user,
> > > > question and answer). The problem is that is not loading my
> > > questions_users
> > > > model and I haven't the relationships :S.
>
> > > > I put a die in questions_users.php and is not loading the file :S.
>
> > > > I'm doing a $uses = array(bla bla, 'QuestionsUser') in my
> > > users_controller.
> > > > I'm calling the find method in app_controller.
>
> > > > If you have any idea of why this is not working... I'm desperated :S
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > 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
> > > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscr...@googlegroups.c­om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: