Commit a02f0854 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Reflexesivité + VH

parent 677437b5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Carriere\Service\Correspondance\CorrespondanceService;
use Carriere\Service\Correspondance\CorrespondanceServiceFactory;
use Carriere\Service\CorrespondanceType\CorrespondanceTypeService;
use Carriere\Service\CorrespondanceType\CorrespondanceTypeServiceFactory;
use Carriere\View\Helper\CorrespondanceViewHelper;
use UnicaenPrivilege\Guard\PrivilegeController;
use Laminas\Router\Http\Literal;
use Laminas\Router\Http\Segment;
@@ -146,6 +147,10 @@ return [
    ],
    'hydrators' => [
        'factories' => [],
    ]

    ],
    'view_helpers' => [
        'invokables' => [
            'correspondance' => CorrespondanceViewHelper::class
        ],
    ],
];
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
        <field name="dateOuverture" column="d_ouverture"    type="datetime"  />
        <field name="dateFermeture" column="d_fermeture"    type="datetime"  />

<!--        <one-to-many field="agentGrades" target-entity="Application\Entity\Db\AgentGrade" mapped-by="bap"/>-->
        <one-to-many field="correspondances" target-entity="Carriere\Entity\Db\Correspondance" mapped-by="type"/>

        <!-- DB IMPORT #############################  -->
        <field name="created_on"               column="created_on"       type="datetime"/>
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ class CorrespondanceService {
     */
    public function createQueryBuilder() {
        $qb = $this->getEntityManager()->getRepository(Correspondance::class)->createQueryBuilder('correspondance')
            ->leftJoin('correspondance.type','ctype')->addSelect('ctype')
            ->andWhere('correspondance.deleted_on IS NULL')
        ;
        return $qb;
+24 −0
Original line number Diff line number Diff line
<?php

namespace Carriere\View\Helper;

use Carriere\Entity\Db\Correspondance;
use Laminas\View\Helper\AbstractHelper;
use Laminas\View\Helper\Partial;
use Laminas\View\Resolver\TemplatePathStack;

class CorrespondanceViewHelper extends AbstractHelper
{
    /**
     * @param Correspondance|null $correspondance
     * @param array $options
     * @return string|Partial
     */
    public function __invoke(?Correspondance $correspondance, array $options = [])
    {
        $view = $this->getView();
        $view->resolver()->attach(new TemplatePathStack(['script_paths' => [__DIR__ . "/partial"]]));

        return $view->partial('correspondance', ['correspondance' => $correspondance, 'options' => $options]);
    }
}
 No newline at end of file
+32 −0
Original line number Diff line number Diff line
<?php

/**
 * @see \Carriere\View\Helper\CorrespondanceViewHelper
 * @var Correspondance|null $correspondance
 * @var array $options
 */

use Carriere\Entity\Db\Correspondance;

?>

<?php if ($correspondance === null) : ?>
    <span class="text-warning">
        Aucune correspondance
    </span>
<?php else: ?>
    <?php if ($correspondance->getType() === null) : ?>
        <span class="text-warning">
            Aucun type
        </span>
    <?php else : ?>
        <span title="<?php echo $correspondance->getType()->getLibelleLong(); ?>">
            <?php echo $correspondance->getType()->getLibelleCourt(); ?>
        </span>
    <?php endif; ?>
    -
    <span title="<?php echo $correspondance->getLibelleLong(); ?>">
        <?php echo $correspondance->getCategorie(); ?>
    </span>
<?php endif; ?>
Loading