Доброе утро,
С правилами разабрался - как это делается, примерно так:
public function attach($owner)
{
parent::attach($owner);
$owner->on(ActiveRecord::EVENT_BEFORE_INSERT,[$this,'onBeforeSave']);
$owner->on(ActiveRecord::EVENT_BEFORE_UPDATE,[$this,'onBeforeSave']);
$owner->on(ActiveRecord::EVENT_AFTER_INSERT,[$this,'onAfterSave']);
$owner->on(ActiveRecord::EVENT_AFTER_UPDATE,[$this,'onAfterSave']);
$owner->on(ActiveRecord::EVENT_AFTER_DELETE,[$this,'onAfterDelete']);
$validators = $owner->getValidators();
$validators[] = Validator::createValidator('integer', $this->owner, 'date_create_stamp');
$validators[] = Validator::createValidator('integer', $this->owner, 'date_update_stamp');
$validators[] = Validator::createValidator('integer', $this->owner, 'author_id');
$validators[] = Validator::createValidator('integer', $this->owner, 'exist');
$validators[] = Validator::createValidator('integer', $this->owner, 'sort');
$validators[] = Validator::createValidator('default', $this->owner, ['date_create','date_update'], ['date', 'value' => date('Y-m-d H:i:s')]);
$validators[] = Validator::createValidator('date', $this->owner, ['date_create','date_update'], ['format' => date('Y-m-d H:i:s')]);
$owner->validators = $validators;
}
А вот с
attributeLabels не нашел информацию. Подскажите пожалуйста!