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

OffreEtapeDiplome

parent 27fc4382
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -2,16 +2,24 @@
<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="Octopus\Entity\Db\OffreDeFormationEtapeDiplome" table="ODF_ETAPE_DIPLOME">

<!--        <id name="etape" association-key="true" />-->
<!--        <id name="diplome" association-key="true"  />-->

        <id name="etape" association-key="true" />
        <id name="diplome" association-key="true" />

<!--        <many-to-one field="etape" target-entity="Octopus\Entity\Db\OffreDeFormationEtape" inversed-by="id" />-->
<!--        <many-to-one field="diplome" target-entity="Octopus\Entity\Db\OffreDeFormationDiplome" inversed-by="id" />-->
        <many-to-one target-entity="Octopus\Entity\Db\OffreDeFormationEtape" field="etape">
            <join-column name="ETAPE_ID" referenced-column-name="ID" />
            <join-column name="ETAPE_ID" referenced-column-name="ETAPE_ID" />
        </many-to-one>

        <many-to-one target-entity="Octopus\Entity\Db\OffreDeFormationDiplome" field="diplome">
            <join-column name="DIPLOME_ID" referenced-column-name="ID" />
            <join-column name="DIPLOME_ID" referenced-column-name="DIPLOME_ID" />
        </many-to-one>


        <field name="cursus"            column="CURSUS_ANNEE"           type="string" length="2"            nullable="true" />
        <field name="niveau"            column="NIV_ETUDE"           type="string" length="2"            nullable="true" />
        <field name="niveau"            column="NIV_ETUDES"           type="string" length="2"            nullable="true" />

    </entity>
</doctrine-mapping>
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

namespace Octopus\Entity\Db;

class OffreDeFormationDiplome {
class OffreDeFormationEtapeDiplome {

    /** @var OffreDeFormationEtape */
    private $etape;
@@ -11,7 +11,7 @@ class OffreDeFormationDiplome {
    /** @var string */
    private $cursus;
    /** @var string */
    private $annee;
    private $niveau;

    /**
     * @return OffreDeFormationEtape
@@ -40,8 +40,8 @@ class OffreDeFormationDiplome {
    /**
     * @return string
     */
    public function getAnnee()
    public function getNiveau()
    {
        return $this->annee;
        return $this->niveau;
    }
}
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Octopus\Service\OffreDeFormation;

use Doctrine\ORM\NonUniqueResultException;
use Octopus\Entity\Db\OffreDeFormationEtapeDiplome;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Service\EntityManagerAwareTrait;
use Octopus\Entity\Db\OffreDeFormationDiplome;
@@ -129,4 +130,21 @@ class OffreDeFormationService {
        return $result;
    }

    /**
     * @param OffreDeFormationEtape $etape
     * @param OffreDeFormationDiplome $diplome
     * @return OffreDeFormationEtapeDiplome
     */
    public function getInfosByEtapeAndDiplome(OffreDeFormationEtape $etape, OffreDeFormationDiplome $diplome) {
        $qb = $this->getEntityManager()->getRepository(OffreDeFormationEtapeDiplome::class)->createQueryBuilder('ed')
            ->andWhere('ed.etape = :etape')
            ->andWhere('ed.diplome = :diplome')
            ->setParameter('etape', $etape)
            ->setParameter('diplome', $diplome)
        ;

        $result = $qb->getQuery()->getOneOrNullResult();
        return $result;
    }

}
 No newline at end of file