Yes, it was newspost.php.

On Oct 6, 9:10 pm, brian <[email protected]> wrote:
> That shouldn't be an issue. What was the file name? If it wasn't
> news_post.php that would do it.
>
>
>
> On Tue, Oct 6, 2009 at 3:01 PM, Raman <[email protected]> wrote:
>
> > Thanks brian, tried that, but it didn't work. I found the solution
> > though. I'm using CakePHP version 1.3, so this might be a bug I really
> > don't know.
>
> > The problem was the capitilization of the 'P' in News'P'ost. I changed
> > the model's names, filenames, etc. to just News and voila, it works!
>
> > On Oct 6, 2:15 pm, brian <[email protected]> wrote:
> >> In Comment.php, add var $belongsTo = array('NewsPost');
>
> >> On Tue, Oct 6, 2009 at 1:02 PM, Raman <[email protected]> wrote:
>
> >> > Hello,
>
> >> > Im very new to CakePHP and have just started to learn Model
> >> > Association. If I make any errors in the google group, please excuse
> >> > me this is my first time on any google group.
>
> >> > I have 2 databases:
>
> >> > -news_posts
> >> >    -id
> >> >    -title
> >> >    -body
>
> >> > -comments
> >> >    -id
> >> >    -body
> >> >    -newspost_id
>
> >> > Here are the AppModel classes associated with them:
>
> >> > // app/models/newspost.php
> >> > class NewsPost extends AppModel {
> >> >    var $name = 'NewsPost';
> >> >    var $hasMany = 'Comment';
> >> > }
>
> >> > // app/models/comment.php
> >> > class Comment extends AppModel {
> >> >    var $name = 'Comment';
> >> > }
>
> >> > The problem is when i call $this->NewsPost->find('all'); from a
> >> > controller that var $uses = 'NewsPost';, I get this array:
>
> >> > Array
> >> > (
> >> >    [0] => Array
> >> >        (
> >> >            [NewsPost] => Array
> >> >                (
> >> >                    [id] => 10
> >> >                    [Title] => Cool, This works! LOL
> >> >                    [Body] => Wow, this really works! OMG LOL OMG
> >> > EDITING WORKS FINE
> >> >                    [Time] => 1254685359
> >> >                )
>
> >> >        )
>
> >> > )
>
> >> > As you can see, there is no [Comment] array in the sub-array [0].
>
> >> > Here is the data for my tables:
>
> >> > news_posts:
>
> >> >   id   |         title       |        body       |
> >> >   10  |   News Title   |   News Body   |
>
> >> > comments:
>
> >> >   id   |            body          |       newspost_id       |
> >> >   1    |   Comment Body   |             10                |
>
> >> > Any help would be greatly appreciated.
>
> >> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to