Browse Source

Modèle Section

feature/module_traiteur_v1
Guillaume 3 years ago
parent
commit
f98b313640
3 changed files with 91 additions and 0 deletions
  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 View File

<?php

namespace Lc\ShopBundle\Context;

interface SectionInterface
{

}

+ 33
- 0
ShopBundle/Model/Section.php View File

<?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 View File

<?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()
;
}
*/
}


Loading…
Cancel
Save