Parcourir la source

Modèle Section

feature/module_traiteur_v1
Guillaume il y a 3 ans
Parent
révision
f98b313640
3 fichiers modifiés avec 91 ajouts et 0 suppressions
  1. +8
    -0
      ShopBundle/Context/SectionInterface.php
  2. +33
    -0
      ShopBundle/Model/Section.php
  3. +50
    -0
      ShopBundle/Repository/SectionRepository.php

+ 8
- 0
ShopBundle/Context/SectionInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface SectionInterface
{

}

+ 33
- 0
ShopBundle/Model/Section.php Voir le fichier

@@ -0,0 +1,33 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
class Section extends AbstractDocumentEntity
{
/**
* @ORM\Column(type="string", length=32)
*/
protected $cycle;

const SECTION_CYCLE_DAY = 'day' ;
const SECTION_CYCLE_WEEK = 'week' ;
const SECTION_CYCLE_MONTH = 'month' ;
const SECTION_CYCLE_YEAR = 'year' ;

public function getCycle(): ?string
{
return $this->cycle;
}

public function setCycle(string $cycle): self
{
$this->cycle = $cycle;

return $this;
}
}

+ 50
- 0
ShopBundle/Repository/SectionRepository.php Voir le fichier

@@ -0,0 +1,50 @@
<?php

namespace Lc\ShopBundle\Repository;

use Lc\ShopBundle\Context\SectionInterface;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;

/**
* @method SectionInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method SectionInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method SectionInterface[] findAll()
* @method SectionInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SectionRepository extends BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return SectionInterface::class;
}

// /**
// * @return Address[] Returns an array of Address objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->orderBy('a.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/

/*
public function findOneBySomeField($value): ?Address
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}


Chargement…
Annuler
Enregistrer