@@ 8-47 (lines=40) @@ | ||
5 | ||
6 | use RZ\Roadiz\Core\Entities\Folder; |
|
7 | ||
8 | final class FoldersProvider extends AbstractDoctrineExplorerProvider |
|
9 | { |
|
10 | protected function getProvidedClassname(): string |
|
11 | { |
|
12 | return Folder::class; |
|
13 | } |
|
14 | ||
15 | protected function getDefaultCriteria(): array |
|
16 | { |
|
17 | return []; |
|
18 | } |
|
19 | ||
20 | protected function getDefaultOrdering(): array |
|
21 | { |
|
22 | return ['folderName' =>'ASC']; |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @inheritDoc |
|
27 | */ |
|
28 | public function supports($item) |
|
29 | { |
|
30 | if ($item instanceof Folder) { |
|
31 | return true; |
|
32 | } |
|
33 | ||
34 | return false; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @inheritDoc |
|
39 | */ |
|
40 | public function toExplorerItem($item) |
|
41 | { |
|
42 | if ($item instanceof Folder) { |
|
43 | return new FolderExplorerItem($item); |
|
44 | } |
|
45 | throw new \InvalidArgumentException('Explorer item must be instance of ' . Folder::class); |
|
46 | } |
|
47 | } |
|
48 |
@@ 8-47 (lines=40) @@ | ||
5 | ||
6 | use RZ\Roadiz\Core\Entities\Setting; |
|
7 | ||
8 | final class SettingsProvider extends AbstractDoctrineExplorerProvider |
|
9 | { |
|
10 | protected function getProvidedClassname(): string |
|
11 | { |
|
12 | return Setting::class; |
|
13 | } |
|
14 | ||
15 | protected function getDefaultCriteria(): array |
|
16 | { |
|
17 | return []; |
|
18 | } |
|
19 | ||
20 | protected function getDefaultOrdering(): array |
|
21 | { |
|
22 | return ['name' =>'ASC']; |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @inheritDoc |
|
27 | */ |
|
28 | public function supports($item) |
|
29 | { |
|
30 | if ($item instanceof Setting) { |
|
31 | return true; |
|
32 | } |
|
33 | ||
34 | return false; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @inheritDoc |
|
39 | */ |
|
40 | public function toExplorerItem($item) |
|
41 | { |
|
42 | if ($item instanceof Setting) { |
|
43 | return new SettingExplorerItem($item); |
|
44 | } |
|
45 | throw new \InvalidArgumentException('Explorer item must be instance of ' . Setting::class); |
|
46 | } |
|
47 | } |
|
48 |
@@ 8-47 (lines=40) @@ | ||
5 | ||
6 | use RZ\Roadiz\Core\Entities\User; |
|
7 | ||
8 | final class UsersProvider extends AbstractDoctrineExplorerProvider |
|
9 | { |
|
10 | protected function getProvidedClassname(): string |
|
11 | { |
|
12 | return User::class; |
|
13 | } |
|
14 | ||
15 | protected function getDefaultCriteria(): array |
|
16 | { |
|
17 | return []; |
|
18 | } |
|
19 | ||
20 | protected function getDefaultOrdering(): array |
|
21 | { |
|
22 | return ['username' =>'ASC']; |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @inheritDoc |
|
27 | */ |
|
28 | public function supports($item) |
|
29 | { |
|
30 | if ($item instanceof User) { |
|
31 | return true; |
|
32 | } |
|
33 | ||
34 | return false; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @inheritDoc |
|
39 | */ |
|
40 | public function toExplorerItem($item) |
|
41 | { |
|
42 | if ($item instanceof User) { |
|
43 | return new UserExplorerItem($item); |
|
44 | } |
|
45 | throw new \InvalidArgumentException('Explorer item must be instance of ' . User::class); |
|
46 | } |
|
47 | } |
|
48 |