title = $title; $page->slug = $slug; $page->content = $content; $page->meta = $meta; $page->type = $type; return $page; } public function edit($title, $slug, $content, $type = Page::TYPE_PUBLIC, Meta $meta): void { $this->title = $title; $this->slug = $slug; $this->content = $content; $this->meta = $meta; $this->type = $type; } public function getSeoTitle(): string { return $this->meta->title ?: $this->title; } public static function tableName(): string { return '{{%pages}}'; } public function behaviors(): array { return [ MetaBehavior::class, [ 'class' => NestedSetsBehavior::class, 'treeAttribute' => 'tree', ], TimestampBehavior::class, ]; } public function transactions(): array { return [ self::SCENARIO_DEFAULT => self::OP_ALL, ]; } public function attributeLabels() { return [ 'title' => Yii::t('page', 'Title'), 'slug' => Yii::t('page', 'Slug'), 'id' => Yii::t('page', 'ID'), 'content' => Yii::t('page', 'Content'), ]; } public static function find(): PageQuery { return new PageQuery(static::class); } }