[Solar-talk] new model & a many to many question
Paul M Jones
pmjones at solarphp.com
Wed Mar 14 20:45:32 PDT 2007
On Mar 14, 2007, at 10:06 PM, Rodrigo Moraes wrote:
>> Does that help at all?
>
> Yes, a lot. Perfect.
Oh good. :-)
> I made a list of the options available for
> relationships and would ask about the through family soon. :)
>
> This is what I got working, including ordering the related model:
...
> Notice that I had to define through_foreign_col and foreign_col in
> game (has_many platforms) and platform (has_many games). I hope these
> are expected. :)
They are. However, sometimes it's hard (for me) to remember whether
I need to set the foreign_col or the native_col. So, there's a
"virtual" option called "foreign_key" that will set the right option
for you automatically (as long as foreign_col and native_col are not
already set). The "foreign_key" option itself never shows up in the
final list of options.
Same thing holds true for "through" -- you can set the virtual
"through_key" options and it'll set the right foreign/native options
for you.
Hope that all makes sense.
> I'll continue exploring now.
Good man! :-)
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list