Solar_Sql_Model::__call()

public mixed Solar_Sql_Model::__call ( string $method , array $params )

Magic call implements "fetchOneBy...()" and "fetchAllBy...()" for columns listed in the method name.

Parameters

  • (string) $method: The virtual method name, composed of "fetchOneBy" or "fetchAllBy", with a series of column names joined by "And".

  • (array) $params: Parameters to pass to the method: one for each column, plus an optional one for extra fetch parameters.

Returns

  • (mixed)

Description

Magic call implements "fetchOneBy...()" and "fetchAllBy...()" for columns listed in the method name.

You have to specify params for all of the named columns.

Optionally, you can pass a final array for the "extra" paramters to the fetch ('order', 'group', 'having', etc.)

Example:

<?php
// fetches one record by status
$model->fetchOneByStatus('draft');

// fetches all records by area_id and owner_handle
$model->fetchAllByAreaIdAndOwnerHandle($area_id, $owner_handle);

// fetches all records by area_id and owner_handle,
// with ordering and page-limiting
$extra = array('order' => 'area_id DESC', 'page' => 2);
$model->fetchAllByAreaIdAndOwnerHandle($area_id, $owner_handle, $extra);


Local