Pages::addWhereClause($clause[,$variables])

Version 2025.4

Add new where clause to query

Return value

$this

Arguments

$clause
SQL where clause
$variables
values Array(value, value, ...)
variables Array(name=>value)

Full documentation

Get all projects that are open:

$Projects = $this->get('pages','project')->addWhereClause("project.status='open'");

Execute values: Get all projects that have 'elementti' in name:

$Projects = $this->get('pages','project')
    ->addWhereClause("project.name LIKE concat('%',?,'%') ", Array('elementti') );

Execute variables: Get all projects that have 'elementti' in name:

$Projects = $this->get('pages','project')
    ->addWhereClause("project.name LIKE concat('%',:name,'%') ", Array(
        'name' => 'elementti'
    ));

Search from join data: Adds automatickly joins to data that is used in clause:

$Projects = $this->get('pages','project')
    ->addWhereClause("client.name LIKE concat('%',:name,'%') ", Array(
        'name' => 'customer'
    ));