You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
477 B
23 lines
477 B
<?php |
|
|
|
namespace common\modules\pages\repositories\read; |
|
|
|
use common\modules\pages\entities\Page; |
|
|
|
class PageReadRepository |
|
{ |
|
public function getAll(): array |
|
{ |
|
return Page::find()->andWhere(['>', 'depth', 0])->all(); |
|
} |
|
|
|
public function find($id): ?Page |
|
{ |
|
return Page::findOne($id); |
|
} |
|
|
|
public function findBySlug($slug): ?Page |
|
{ |
|
return Page::find()->andWhere(['slug' => $slug])->andWhere(['>', 'depth', 0])->one(); |
|
} |
|
} |