Commit bbc60722 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Mise en place de la nouvelle config pour les formules de calcul

parent c4198f55
This diff is collapsed.
......@@ -28,6 +28,9 @@ return [
],
'service_manager' => [
'factories' => [
Service\FormuleService::class => Service\Factory\FormuleServiceFactory::class,
],
'invokables' => [
Service\FormuleResultatService::class => Service\FormuleResultatService::class,
Service\FormuleResultatServiceService::class => Service\FormuleResultatServiceService::class,
......
<?php
namespace Application\Entity\Db;
/**
* Formule
*/
class Formule
{
/**
* @var integer
*/
protected $id;
/**
* @var string
*/
protected $libelle;
/**
* @var string
*/
protected $packageName;
/**
* @var string
*/
protected $procedureName;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getLibelle()
{
return $this->libelle;
}
/**
* @param string $libelle
*
* @return Formule
*/
public function setLibelle(string $libelle): Formule
{
$this->libelle = $libelle;
return $this;
}
/**
* @return string
*/
public function getPackageName()
{
return $this->packageName;
}
/**
* @param string $packageName
*
* @return Formule
*/
public function setPackageName(string $packageName): Formule
{
$this->packageName = $packageName;
return $this;
}
/**
* @return string
*/
public function getProcedureName()
{
return $this->procedureName;
}
/**
* @param string $procedureName
*
* @return Formule
*/
public function setProcedureName(string $procedureName): Formule
{
$this->procedureName = $procedureName;
return $this;
}
/**
* Retourne la représentation littérale de cet objet.
*
* @return string
*/
public function __toString()
{
return $this->getLibelle();
}
}
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\Db\Formule" table="FORMULE">
<id name="id" type="integer" column="ID">
<generator strategy="SEQUENCE"/>
</id>
<field name="libelle" type="string" column="LIBELLE" length="100" nullable="false"/>
<field name="packageName" type="string" column="PACKAGE_NAME" length="30" nullable="false"/>
<field name="procedureName" type="string" column="PROCEDURE_NAME" length="30" nullable="false"/>
</entity>
</doctrine-mapping>
......@@ -6,6 +6,7 @@ use Application\Entity\Db\Parametre;
use Application\Service\Traits\AnneeServiceAwareTrait;
use Application\Service\Traits\DomaineFonctionnelServiceAwareTrait;
use Application\Service\Traits\EtatSortieServiceAwareTrait;
use Application\Service\Traits\FormuleServiceAwareTrait;
use Application\Service\Traits\PaysServiceAwareTrait;
use Application\Service\Traits\ScenarioServiceAwareTrait;
use Application\Service\Traits\StructureServiceAwareTrait;
......@@ -28,6 +29,7 @@ class ParametresForm extends AbstractForm
use PaysServiceAwareTrait;
use StructureServiceAwareTrait;
use EtatSortieServiceAwareTrait;
use FormuleServiceAwareTrait;
public function init()
{
......@@ -138,18 +140,14 @@ class ParametresForm extends AbstractForm
$this->add($etablissement);
$this->add([
'name' => 'formule_function_name',
'type' => 'Text',
'options' => [
'label' => 'Fonction',
'type' => 'Select',
'name' => 'formule',
'options' => [
'value_options' => Util::collectionAsOptions($this->getServiceFormule()->getList()),
],
]);
$this->add([
'name' => 'formule_package_name',
'type' => 'Text',
'options' => [
'label' => 'Package Oracle',
'attributes' => [
'class' => 'selectpicker',
'data-live-search' => 'true'
],
]);
......
<?php
namespace Application\Service\Factory;
use Application\Constants;
use Zend\ServiceManager\ServiceLocatorInterface as ContainerInterface;
use Application\Service\FormuleService;
/**
* Description of FormuleServiceFactory
*
* @author LECLUSE Laurent <laurent.lecluse at unicaen.fr>
*/
class FormuleServiceFactory
{
/**
* @param ContainerInterface $container
* @param string $requestedName
* @param array|null $options
*
* @return FormuleService
*/
public function __invoke(ContainerInterface $container, $requestedName, $options = null)
{
$service = new FormuleService;
$service->setEntityManager($container->get(Constants::BDD));
return $service;
}
}
\ No newline at end of file
<?php
namespace Application\Service;
use Application\Entity\Db\Formule;
/**
* Description of FormuleService
*
* @author LECLUSE Laurent <laurent.lecluse at unicaen.fr>
*
* @method Formule get($id)
* @method Formule[] getList(\Doctrine\ORM\QueryBuilder $qb = null, $alias = null)
* @method Formule newEntity()
*
*/
class FormuleService extends AbstractEntityService
{
/**
* retourne la classe des entités
*
* @return string
* @throws RuntimeException
*/
public function getEntityClass()
{
return Formule::class;
}
/**
* Retourne l'alias d'entité courante
*
* @return string
*/
public function getAlias(){
return 'formule';
}
}
\ No newline at end of file
<?php
namespace Application\Service\Traits;
use Application\Service\FormuleService;
/**
* Description of FormuleServiceAwareTrait
*
* @author UnicaenCode
*/
trait FormuleServiceAwareTrait
{
/**
* @var FormuleService
*/
protected $serviceFormule;
/**
* @param FormuleService $serviceFormule
* @return self
*/
public function setServiceFormule( FormuleService $serviceFormule )
{
$this->serviceFormule = $serviceFormule;
return $this;
}
/**
* @return FormuleService
*/
public function getServiceFormule() : FormuleService
{
if (!$this->serviceFormule){
$this->serviceFormule = \Application::$container->get(FormuleService::class);
}
return $this->serviceFormule;
}
}
\ No newline at end of file
......@@ -107,11 +107,8 @@
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
<?= $this->formControlGroup($form->get('formule_package_name')); ?>
</div>
<div class="col-md-6">
<?= $this->formControlGroup($form->get('formule_function_name')); ?>
<div class="col-md-12">
<?= $this->formControlGroup($form->get('formule')); ?>
</div>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment