onBeforeBuildQuery() публичный Метод

This event runs before we have built the query used to fetch a record list in a model. It is used to apply automatic query filters.
public onBeforeBuildQuery ( &$model, &$query ) : void
Результат void
Пример #1
0
 /**
  * @group           Behaviour
  * @group           EnabledOnBeforeBuildQuery
  * @covers          FOF30\Model\DataModel\Behaviour\Enabled::onBeforeBuildQuery
  * @dataProvider    EnabledDataprovider::getTestOnBeforeBuildQuery
  */
 public function testOnBeforeBuildQuery($test, $check)
 {
     $msg = 'Own::onAfterBuildQuery %s - Case: ' . $check['case'];
     $config = array('idFieldName' => $test['tableid'], 'tableName' => $test['table']);
     $model = new DataModelStub(static::$container, $config);
     $query = \JFactory::getDbo()->getQuery(true)->select('*')->from('test');
     $dispatcher = $model->getBehavioursDispatcher();
     $behavior = new Enabled($dispatcher);
     $behavior->onBeforeBuildQuery($model, $query);
     $where = ReflectionHelper::getValue($model, 'whereClauses');
     $this->assertCount($check['count'], $where, sprintf($msg, 'Failed to set the where'));
 }