[Solar-talk] Changes afoot: a new Model class
Paul M Jones
pmjones at ciaweb.net
Fri Feb 9 08:34:30 PST 2007
On Feb 8, 2007, at 5:50 AM, mikko at sorl.net wrote:
> This might be somewhat out of context, but have you looked at
> phpdoctrine as a model component? Choosing between existing php orms I
> find this one the most interesting.
Not out of context at all. In fact, this documentation page for
Doctrine ...
<http://phpdoctrine.net/doctrine/manual/documentation.php?index=4.2>
... looks very similar to the intended use of Solar_Sql_Model.
Doctrine usage:
$table = $conn->getTable("User");
// find by primary key
$user = $table->find(2);
if($user !== false)
print $user->name;
// get all users
foreach($table->findAll() as $user) {
print $user->name;
}
Solar_Sql_Model usage:
$users = Solar::factory('Solar_Model_Users');
// find by primary key
$user = $users->fetch(2);
if ($user->id) {
print $user->name;
}
// get all users
foreach ($users->fetchAll() as $user) {
print $user->name;
}
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list