Hi all,
I'm new to the framework, and i am quite impressed with it. Only now i have a problem. When i use the ActiveRecord relations i get a Http 500 error.
What i have is as follows. I have a Blog model and a Comment model. I want to get the comments that belong to the blogs. In my blog model i specified the relation like this:
public function relations() { return array( 'comments'=>array(self::HAS_MANY, 'Comment', 'blog_id') ); }
I then try to find all blogs, which works fine. Then i try to get the comments that belong to the blogs:
$blogs = Blog::model()->with('comments')->findAll();
Then i just get a Http 500 error and in my error log this is inserted:
[Wed Dec 17 11:22:45 2008] [error] [client 62.51.191.128] PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0
Could anyone please help? I love the framework but this is just weird. By the way, i'm running a windows install of Apache & PHP 5.3 & MySQL. It couldnt be the PHP5.3 alpha could it? I've never seen it break anything OO based.
Thanks in advanced!
EDIT
I seem to have found the problem, somewhere along the line this exception is thrown: The relation "comments" in active record class "Blog" is specified with an invalid foreign key "blog". The foreign key does not point to either joining table.
The problem why it gives a HTTP 500 error is because for some reason PHP refuses to throw an exception from a controller. The reason for the error is because the framework doesn't load foreign keys for some reason.