1 <?php
 2 /**
 3  * @package     FrameworkOnFramework
 4  * @subpackage  model
 5  * @copyright   Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
 6  * @license     GNU General Public License version 2 or later; see LICENSE.txt
 7  */
 8 // Protect from unauthorized access
 9 defined('FOF_INCLUDED') or die;
10 
11 /**
12  * FrameworkOnFramework model behavior class
13  *
14  * @package  FrameworkOnFramework
15  * @since    2.1
16  */
17 class FOFModelBehaviorEmptynonzero extends FOFModelBehavior
18 {
19     /**
20      * This event runs when we are building the query used to fetch a record
21      * list in a model
22      *
23      * @param   FOFModel        &$model  The model which calls this event
24      * @param   FOFDatabaseQuery  &$query  The query being built
25      *
26      * @return  void
27      */
28     public function onBeforeBuildQuery(&$model, &$query)
29     {
30         $model->setState('_emptynonzero', '1');
31     }
32 }
33