Commit 76c53f45 authored by Bertrand Gauthier's avatar Bertrand Gauthier Committed by Thomas Hamel
Browse files

Saisie these : scission par domaine

parent 4a0fffce
Loading
Loading
Loading
Loading
+16 −2
Changes for module/Application/src/Application/Service/Source/SourceService.php: 16 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@ namespace Application\Service\Source;

use Application\Entity\Db\Source;
use Application\Service\BaseService;
use Application\SourceCodeStringHelperAwareTrait;
use Doctrine\ORM\EntityRepository;
use Structure\Entity\Db\Etablissement;
use UnicaenApp\Exception\RuntimeException;

/**
@@ -12,6 +14,8 @@ use UnicaenApp\Exception\RuntimeException;
 */
class SourceService extends BaseService
{
    use SourceCodeStringHelperAwareTrait;

    const APPL_SOURCE_CODE = 'SYGAL::sygal';

    const SQL_TEMPLATE_CREATE_APP_SOURCE =
@@ -20,7 +24,7 @@ class SourceService extends BaseService
    /**
     * @return EntityRepository
     */
    public function getRepository()
    public function getRepository(): EntityRepository
    {
        /** @var EntityRepository $repo */
        $repo = $this->entityManager->getRepository(Source::class);
@@ -31,7 +35,7 @@ class SourceService extends BaseService
    /**
     * @return Source
     */
    public function fetchApplicationSource()
    public function fetchApplicationSource(): Source
    {
        $codeApp = self::APPL_SOURCE_CODE;

@@ -48,4 +52,14 @@ class SourceService extends BaseService

        return $source;
    }

    /**
     * Génère un SOURCE_CODE par défaut.
     *
     * @return string
     */
    public function genereateSourceCode(): string
    {
        return $this->sourceCodeStringHelper->addDefaultPrefixTo(uniqid());
    }
}
 No newline at end of file
+1 −10
Changes for module/Application/src/Application/Service/Source/SourceServiceAwareTrait.php: 1 added line, 10 removed lines.
Original line number Diff line number Diff line
@@ -7,19 +7,10 @@ namespace Application\Service\Source;
 */
trait SourceServiceAwareTrait
{
    /**
     * @var SourceService
     */
    protected $sourceService;
    protected SourceService $sourceService;

    /**
     * @param SourceService $sourceService
     * @return self
     */
    public function setSourceService(SourceService $sourceService)
    {
        $this->sourceService = $sourceService;

        return $this;
    }
}
 No newline at end of file
+6 −7
Changes for module/Application/src/Application/Service/Source/SourceServiceFactory.php: 6 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Application\Service\Source;

use Application\SourceCodeStringHelper;
use Interop\Container\ContainerInterface;

/**
@@ -10,17 +11,15 @@ use Interop\Container\ContainerInterface;
class SourceServiceFactory
{
    /**
     * @param ContainerInterface $container
     * @param string             $requestedName
     * @param array|null         $options
     *
     * @return SourceService
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null)
    public function __invoke(ContainerInterface $container): SourceService
    {
        $service = new SourceService;

        /* Injectez vos dépendances ICI */
        $helper = $container->get(SourceCodeStringHelper::class);
        $service->setSourceCodeStringHelper($helper);

        return $service;
    }
+5 −7
Changes for module/Application/src/Application/SourceCodeStringHelperFactory.php: 5 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -2,18 +2,16 @@

namespace Application;

use UnicaenApp\Exception\RuntimeException;
use Interop\Container\ContainerInterface;
use UnicaenApp\Exception\RuntimeException;

class SourceCodeStringHelperFactory
{
    /**
     * Create helper
     *
     * @param ContainerInterface $container
     * @return SourceCodeStringHelper
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    public function __invoke(ContainerInterface $container)
    public function __invoke(ContainerInterface $container): SourceCodeStringHelper
    {
        $config = $container->get('Config');
        $prefix = $this->getDefaultPrefixFromConfig($config);
@@ -28,7 +26,7 @@ class SourceCodeStringHelperFactory
     * @param array $config
     * @return string
     */
    private function getDefaultPrefixFromConfig(array $config)
    private function getDefaultPrefixFromConfig(array $config): string
    {
        $key = 'default_prefix_for_source_code';

+4 −6
Changes for module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -71,12 +71,10 @@ class EcoleDoctorale implements

    public function __toString(): string
    {
        $str = '';
        if ($sigle = $this->structure->getSigle()) {
            $str .= "$sigle - ";
        }
        $str .= $this->structure->getLibelle();
        return $str;
        return implode(' - ', array_filter([
            $this->structure->getSigle(),
            $this->structure->getLibelle()
        ]));
    }

    /**
Loading