Loading saved records
The "load" method allows the initialisation of the current object based on a database record retrieved from its primary key value or from on a where query statement.
Available options
- throws_exception: Throws an exception on sql error instead of returning boolean
Exemples using the load method
Loading a record from its primary key
$user->load(1);
$user->load('1');
Loading a record from a "where" query statement
$user->load(
'username=? AND password=?',
array('my username','my password'),
array('throws_exception'=>true)
);
Loading a record from an array (similar to calling method "fromArray")
$user->load(array('id'=>1));
The "reload" method
This method only applied to records which were previously saved. Its behavior is similar to calling the "load" method with the record primary key value as its first argument.
Accepted options are the same as the one defined in the "load" method.