Login +

Documentation

SLS_FrontModel::countModels

Since SillySmart 1.0

Description

Count the number of objects of models
public int countModels ( string $table, [ array $joins ] , [ array $clause ] , [ array $group ] );

Parameters

  • string $table
    the current table to list (default: empty => current model)
  • array $joins
    the table(s) to join with current table (default: empty => no join) If you want to natural join:
    array("table_2","table_3","...","table_n")
    will give 'SELECT * FROM table_1 NATURAL JOIN table_2 NATURAL JOIN table_3 ... NATURAL JOIN table_n' If you want to join with a specific column:
    array(0=>array("table"=>"table_2","column"=>"column_2"),1=>array("table"=>"table_3","column"=>"column_3"))
  • array $clause
    the clause wanted (default: empty => no clause)
     array
     (
    ||t||||t||[0] => array
    ||t||||t||||t||||t||(
    ||t||||t||||t||||t||||t||["column"] = "column_1",
    ||t||||t||||t||||t||||t||["value"] = "value_1", // or array('value1','value2','...','valueN') if "in" mode
    ||t||||t||||t||||t||||t||["mode"] = "like" or "notlike" or "beginwith" or "endwith" or "equal" or "notequal" or "lt" or "le" or "ge" or "gt" or "null" or "notnull" or "in"
    ||t||||t||||t||||t||)
    ||t||||t||[1] => array
    ||t||||t||||t||||t||(
    ||t||||t||||t||||t||||t||["column"] = "user_department",
    ||t||||t||||t||||t||||t||["value"] = "75", // or array('value1','value2','...','valueN') if "in" mode
    ||t||||t||||t||||t||||t||["mode"] = "like" or "notlike" or "beginwith" or "endwith" or "equal" or "notequal" or "lt" or "le" or "ge" or "gt" or "null" or "notnull" or "in"
    ||t||||t||||t||||t||)
     )
     
  • array $group
    a group by (default: empty => no group by)
    array("column_1","column_2","...","column_n")

Return

int $nbResults
the number of objects within limit
No exemples.

Comments

No comment on this function, be the first !

Add your comment

You must login/register to post a reply.