David Lauzon Wed Jun 29 12:34:21 -0400 2011

Subject: Assigning the associated object

Hi first all, I'm so happy that someone took the time to port Active Record to PHP !

I would expect the following code to work, but I get an UndefinedPropertyException for Location->provider :

[code]
$provider = DataProvider::create( array('name' => 'my provider') );
$location = Location::create( array(
'latitude' => 2345.6, 'longitude' => 3456.7, 'altitude' => 567.8,
'provider' => $provider
) );
[/code]

However using 'provider_id' => $provider->id works!

-D


Nanne Huiges Fri Jul 01 11:49:01 -0400 2011

It seems to me it's saying that you are trying to use a field "provider" where there is no such field, and you should use provider_id. If Provider_id works, why not use that?

(1-1/1)