public function getBehaviors($model)
{
$behaviors = [];
$schema = $model->schema();
$fields = $schema->columns();
if (empty($fields)) {
return [];
}
if (in_array('created', $fields) || in_array('modified', $fields)) {
$behaviors['Timestamp'] = [];
}
if (in_array('lft', $fields) && $schema->columnType('lft') === 'integer' && in_array('rght', $fields) && $schema->columnType('rght') === 'integer' && in_array('parent_id', $fields)) {
$behaviors['Tree'] = [];
}
$counterCache = $this->getCounterCache($model);
if (!empty($counterCache)) {
$behaviors['CounterCache'] = $counterCache;
}
return $behaviors;
}