Commit 57fa902c authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Factories suite

parent 829c4881
Loading
Loading
Loading
Loading
+2 −0
Changes for module/OffreFormation/config/module.config.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -628,6 +628,8 @@ return [
        Processus\ReconductionProcessus::class          => Processus\Factory\ReconductionProcessusFactory::class,
        Service\TypeInterventionStructureService::class => Service\Factory\TypeInterventionStructureServiceFactory::class,
        Service\TypeInterventionStatutService::class    => Service\Factory\TypeInterventionStatutServiceFactory::class,
        Service\TypeHeuresService::class                => Service\TypeHeuresServiceFactory::class,
        Service\CentreCoutEpService::class              => Service\CentreCoutEpServiceFactory::class,
    ],
    'forms'        => [
        Form\DisciplineForm::class                                       => Form\Factory\DisciplineFormFactory::class,
+39 −0
Changes for module/OffreFormation/src/Service/CentreCoutEpServiceAwareTrait.php: 39 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace OffreFormation\Service;


/**
 * Description of CentreCoutEpServiceAwareTrait
 *
 * @author UnicaenCode
 */
trait CentreCoutEpServiceAwareTrait
{
    protected ?CentreCoutEpService $serviceCentreCoutEp = null;



    /**
     * @param CentreCoutEpService $serviceCentreCoutEp
     *
     * @return self
     */
    public function setServiceCentreCoutEp(?CentreCoutEpService $serviceCentreCoutEp)
    {
        $this->serviceCentreCoutEp = $serviceCentreCoutEp;

        return $this;
    }



    public function getServiceCentreCoutEp(): ?CentreCoutEpService
    {
        if (empty($this->serviceCentreCoutEp)) {
            $this->serviceCentreCoutEp = \Application::$container->get(CentreCoutEpService::class);
        }

        return $this->serviceCentreCoutEp;
    }
}
 No newline at end of file
+32 −0
Changes for module/OffreFormation/src/Service/CentreCoutEpServiceFactory.php: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace OffreFormation\Service;

use Psr\Container\ContainerInterface;



/**
 * Description of CentreCoutEpServiceFactory
 *
 * @author Laurent Lécluse <laurent.lecluse at unicaen.fr>
 */
class CentreCoutEpServiceFactory
{

    /**
     * @param ContainerInterface $container
     * @param string             $requestedName
     * @param array|null         $options
     *
     * @return CentreCoutEpService
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null): CentreCoutEpService
    {
        $service = new CentreCoutEpService;

        /* Injectez vos dépendances ICI */

        return $service;
    }
}
 No newline at end of file
+39 −0
Changes for module/OffreFormation/src/Service/TypeHeuresServiceAwareTrait.php: 39 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace OffreFormation\Service;


/**
 * Description of TypeHeuresServiceAwareTrait
 *
 * @author UnicaenCode
 */
trait TypeHeuresServiceAwareTrait
{
    protected ?TypeHeuresService $serviceTypeHeures = null;



    /**
     * @param TypeHeuresService $serviceTypeHeures
     *
     * @return self
     */
    public function setServiceTypeHeures(?TypeHeuresService $serviceTypeHeures)
    {
        $this->serviceTypeHeures = $serviceTypeHeures;

        return $this;
    }



    public function getServiceTypeHeures(): ?TypeHeuresService
    {
        if (empty($this->serviceTypeHeures)) {
            $this->serviceTypeHeures = \Application::$container->get(TypeHeuresService::class);
        }

        return $this->serviceTypeHeures;
    }
}
 No newline at end of file
+32 −0
Changes for module/OffreFormation/src/Service/TypeHeuresServiceFactory.php: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace OffreFormation\Service;

use Psr\Container\ContainerInterface;



/**
 * Description of TypeHeuresServiceFactory
 *
 * @author Laurent Lécluse <laurent.lecluse at unicaen.fr>
 */
class TypeHeuresServiceFactory
{

    /**
     * @param ContainerInterface $container
     * @param string             $requestedName
     * @param array|null         $options
     *
     * @return TypeHeuresService
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null): TypeHeuresService
    {
        $service = new TypeHeuresService;

        /* Injectez vos dépendances ICI */

        return $service;
    }
}
 No newline at end of file
Loading