Passed
Push — master ( cbe288...130872 )
by Peter
02:31
created

PageCategory::createEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Website\Http\Controllers\Admin\Form;
6
7
use AbterPhp\Framework\Assets\AssetManager;
8
use AbterPhp\Framework\Domain\Entities\IStringerEntity;
9
use AbterPhp\Framework\Http\Controllers\Admin\FormAbstract;
10
use AbterPhp\Framework\I18n\ITranslator;
11
use AbterPhp\Framework\Session\FlashService;
12
use AbterPhp\Website\Domain\Entities\PageCategory as Entity;
13
use AbterPhp\Website\Form\Factory\PageCategory as FormFactory;
14
use AbterPhp\Website\Orm\PageCategoryRepo as Repo;
15
use Opulence\Events\Dispatchers\IEventDispatcher;
16
use Opulence\Routing\Urls\UrlGenerator;
17
use Opulence\Sessions\ISession;
18
19
class PageCategory extends FormAbstract
20
{
21
    const ENTITY_SINGULAR = 'pageCategory';
22
    const ENTITY_PLURAL   = 'pageCategories';
23
24
    const ENTITY_TITLE_SINGULAR = 'website:pageCategory';
25
    const ENTITY_TITLE_PLURAL   = 'website:pageCategories';
26
27
    /** @var string */
28
    protected $resource = 'page_categories';
29
30
    /**
31
     * PageCategory constructor.
32
     *
33
     * @param FlashService     $flashService
34
     * @param ITranslator      $translator
35
     * @param UrlGenerator     $urlGenerator
36
     * @param Repo             $repo
37
     * @param ISession         $session
38
     * @param FormFactory      $formFactory
39
     * @param IEventDispatcher $eventDispatcher
40
     */
41
    public function __construct(
42
        FlashService $flashService,
43
        ITranslator $translator,
44
        UrlGenerator $urlGenerator,
45
        Repo $repo,
46
        ISession $session,
47
        FormFactory $formFactory,
48
        IEventDispatcher $eventDispatcher
49
    ) {
50
        parent::__construct($flashService, $translator, $urlGenerator, $repo, $session, $formFactory, $eventDispatcher);
51
    }
52
53
    /**
54
     * @param string $entityId
55
     *
56
     * @return Entity
57
     */
58
    protected function createEntity(string $entityId): IStringerEntity
59
    {
60
        return new Entity($entityId, '', '');
61
    }
62
}
63