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.

28 lines
608 B

7 years ago
<?php
namespace common\modules\pages\repositories\read;
7 years ago
use common\modules\pages\entities\Page;
7 years ago
class PageReadRepository
{
public function getAll(): array
{
return Page::find()->typePublic()->andWhere(['>', 'depth', 0])->all();
7 years ago
}
public function find($id): ?Page
{
return Page::findOne($id);
}
public function findBySlug($slug): ?Page
{
return Page::find()->typePublic()->andWhere(['slug' => $slug])->andWhere(['>', 'depth', 0])->one();
7 years ago
}
public function findPreview($id): ?Page
{
return Page::find()->andWhere(['id' => $id])->one();
}
7 years ago
}