__construct() public method

The $config array understands the following keys: - table: Name of the database table to represent - alias: Alias to be assigned to this table (default to table name) - connection: The connection instance to use - entityClass: The fully namespaced class name of the entity class that will represent rows in this table. - schema: A \Cake\Database\Schema\Table object or an array that can be passed to it. - eventManager: An instance of an event manager to use for internal events - behaviors: A BehaviorRegistry. Generally not used outside of tests. - associations: An AssociationCollection instance. - validator: A Validator instance which is assigned as the "default" validation set, or an associative array, where key is the name of the validation set and value the Validator instance.
public __construct ( array $config = [] )
$config array List of options for this table
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->filterTimes = array('all_time' => array('label' => 'All Time', 'limit' => null, 'group' => "DATE_FORMAT(Incidents.created, '%m %Y')"), 'day' => array('label' => 'Last Day', 'limit' => date('Y-m-d', strtotime('-1 day')), 'group' => "DATE_FORMAT(Incidents.created, '%a %b %d %Y %H')"), 'week' => array('label' => 'Last Week', 'limit' => date('Y-m-d', strtotime('-1 week')), 'group' => "DATE_FORMAT(Incidents.created, '%a %b %d %Y')"), 'month' => array('label' => 'Last Month', 'limit' => date('Y-m-d', strtotime('-1 month')), 'group' => "DATE_FORMAT(Incidents.created, '%a %b %d %Y')"), 'year' => array('label' => 'Last Year', 'limit' => date('Y-m-d', strtotime('-1 year')), 'group' => "DATE_FORMAT(Incidents.created, '%b %u %Y')"));
 }
Example #2
0
 public function __construct(array $config = [])
 {
     parent::__construct($config);
     Hook::applyHookMethods('Hook.table_methods', $this);
     $this->eventManager()->dispatch(new Event('SpiderTable.afterConstruct', $this));
 }