[Solar-talk] Added notes on working with Models/Records to the
wiki
Oscar M.
oscar at oscarm.org
Wed Nov 14 07:45:10 CST 2007
Rodrigo Moraes wrote:
> On Nov 13, 2007 12:44 PM, Oscar M. wrote:
>
>> I've been lurking on the list for a while, and over the last 2 weeks
>> have finally started playing with the latest Solar code. I banged my
>> head a little trying to get the Model/Record stuff setup correctly. As
>> a result added my notes about how to make it work to the wiki
>> <http://solarphp.org/wiki/tutorials/SettingUpModels>. I hope it can be
>> a useful addition to Solar's documentation, especially for helping
>> newcomers feel productive quickly.
>>
>
> Very nice and clear, thank you. :)
>
> I'm thinking to add some notes about the magic fetch* methods, i.e.
> you can call "fetchAllByStatus(1)" and the method doesn't necessarily
> need to exist in your model. When called, in this example it'd return
> all records with the column "status" = 1. It is also available for
> fetchOne and you can define *two* column values. Some examples:
>
> $record = $model->fetchOneByStatus(1);
> $record = $model->fetchOneByStatusAndName(1, 'foo');
>
> $collection = $model->fetchAllByName('foo');
> $collection = $model->fetchAllByNameAndOtherName('foo', 'bar');
>
> An optional array with parameters for the fetch (like those we use for
> normal fetch's) can be added as a last parameters for all the examples
> above:
>
> $record = $model->fetchOneByStatus(1, $params);
> $record = $model->fetchOneByStatusAndName(1, 'foo', $params);
>
> ... etc.
>
> These are very handy for common/basic/quick fetch's we do all the time.
>
> -- rodrigo
> _______________________________________________
> Solar-talk mailing list
> Solar-talk at lists.solarphp.com
> http://mailman-mail3.webfaction.com/listinfo/solar-talk
>
Rodrigo, that would be very handy to add. I haven't used the magic
fetch methods myself, but they sound very useful for common queries.
-Oscar
More information about the Solar-talk
mailing list