|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Traits; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Repository\ResourceNodeRepository; |
|
10
|
|
|
use Chamilo\CoreBundle\ToolChain; |
|
11
|
|
|
use Cocur\Slugify\SlugifyInterface; |
|
12
|
|
|
use Doctrine\ORM\EntityManager; |
|
13
|
|
|
use Doctrine\ORM\EntityRepository; |
|
14
|
|
|
use League\Flysystem\FilesystemInterface; |
|
15
|
|
|
use Symfony\Component\Routing\RouterInterface; |
|
16
|
|
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; |
|
17
|
|
|
|
|
18
|
|
|
trait NonResourceRepository |
|
19
|
|
|
{ |
|
20
|
|
|
protected EntityRepository $repository; |
|
21
|
|
|
|
|
22
|
|
|
protected FilesystemInterface $fs; |
|
23
|
|
|
|
|
24
|
|
|
protected EntityManager $entityManager; |
|
25
|
|
|
|
|
26
|
|
|
protected ?RouterInterface $router = null; |
|
27
|
|
|
|
|
28
|
|
|
protected ?ResourceNodeRepository $resourceNodeRepository = null; |
|
29
|
|
|
|
|
30
|
|
|
protected ?AuthorizationCheckerInterface $authorizationChecker = null; |
|
31
|
|
|
|
|
32
|
|
|
protected ?SlugifyInterface $slugify = null; |
|
33
|
|
|
|
|
34
|
|
|
protected ?ToolChain $toolChain = null; |
|
35
|
|
|
|
|
36
|
|
|
public function setAuthorizationChecker(AuthorizationCheckerInterface $authorizationChecker): self |
|
37
|
|
|
{ |
|
38
|
|
|
$this->authorizationChecker = $authorizationChecker; |
|
39
|
|
|
|
|
40
|
|
|
return $this; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function setRouter(RouterInterface $router): self |
|
44
|
|
|
{ |
|
45
|
|
|
$this->router = $router; |
|
46
|
|
|
|
|
47
|
|
|
return $this; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function setSlugify(SlugifyInterface $slugify): self |
|
51
|
|
|
{ |
|
52
|
|
|
$this->slugify = $slugify; |
|
53
|
|
|
|
|
54
|
|
|
return $this; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function setToolChain(ToolChain $toolChain): self |
|
58
|
|
|
{ |
|
59
|
|
|
$this->toolChain = $toolChain; |
|
60
|
|
|
|
|
61
|
|
|
return $this; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function setResourceNodeRepository(ResourceNodeRepository $resourceNodeRepository): self |
|
65
|
|
|
{ |
|
66
|
|
|
$this->resourceNodeRepository = $resourceNodeRepository; |
|
67
|
|
|
|
|
68
|
|
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|