Fab 4 년 전
부모
커밋
1fdee0e8c5
5개의 변경된 파일78개의 추가작업 그리고 10개의 파일을 삭제
  1. +9
    -10
      ShopBundle/Controller/Admin/AdminController.php
  2. +5
    -0
      ShopBundle/Model/PointSale.php
  3. +1
    -0
      ShopBundle/Resources/views/backend/default/list_day.html.twig
  4. +26
    -0
      ShopBundle/Services/Utils.php
  5. +37
    -0
      ShopBundle/Twig/BridgeTwigExtension.php

+ 9
- 10
ShopBundle/Controller/Admin/AdminController.php 파일 보기

@@ -138,19 +138,18 @@ class AdminController extends EasyAdminController
}


//ça bloque tout ce truc là faut qu'on en parle

/* if (method_exists($entity, 'getAddress')) {
if (method_exists($entity, 'getAddress') && $entity->getAddress()) {
$entity->getAddress()->setCreatedBy($this->security->getUser());
$entity->getAddress()->setCreatedAt(new \DateTime());
}

if (method_exists($entity, 'getAddresses')) {
if (method_exists($entity, 'getAddresses')
&& $entity->getAddresses() && count($entity->getAddresses()) > 0) {
foreach($entity->getAddresses() as $address) {
$address->setCreatedBy($this->security->getUser()) ;
$address->setCreatedAt(new \DateTime()) ;
}
}*/
}

$this->setUpdated($entity);

@@ -179,13 +178,13 @@ class AdminController extends EasyAdminController
$entity->setUpdatedBy($this->security->getUser());
}

//ça bloque tout ce truc là faut qu'on en parle
/*
if (method_exists($entity, 'getAddress')) {
if (method_exists($entity, 'getAddress') && $entity->getAddress()) {
$entity->getAddress()->setUpdatedBy($this->security->getUser());
}

if (method_exists($entity, 'getAddresses')) {
if (method_exists($entity, 'getAddresses')
&& $entity->getAddresses() && count($entity->getAddresses()) > 0) {

foreach($entity->getAddresses() as $address) {
$address->setUpdatedBy($this->security->getUser()) ;
$address->setUpdatedAt(new \DateTime()) ;
@@ -194,7 +193,7 @@ class AdminController extends EasyAdminController
$address->setCreatedAt(new \DateTime()) ;
}
}
}*/
}
}

public function listChildrenAction()

+ 5
- 0
ShopBundle/Model/PointSale.php 파일 보기

@@ -38,6 +38,11 @@ abstract class PointSale extends AbstractDocumentEntity
$this->pointSaleDayInfos = new ArrayCollection();
}

public function __toString()
{
return $this->getTitle() ;
}

/**
* @return Collection|Merchant[]
*/

+ 1
- 0
ShopBundle/Resources/views/backend/default/list_day.html.twig 파일 보기

@@ -0,0 +1 @@
{{ getDayByNumber(value) }}

+ 26
- 0
ShopBundle/Services/Utils.php 파일 보기

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

namespace Lc\ShopBundle\Services;

class Utils
{
public static function getDayByNumber($number)
{
$daysArray = [
1 => 'Lundu',
2 => 'Mardi',
3 => 'Mercredi',
4 => 'Jeudi',
5 => 'Vendredi',
6 => 'Samedi',
7 => 'Dimanche'
] ;

if(isset($daysArray[$number])) {
return $daysArray[$number] ;
}

return '' ;
}

}

+ 37
- 0
ShopBundle/Twig/BridgeTwigExtension.php 파일 보기

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

namespace Lc\ShopBundle\Twig;

use Lc\ShopBundle\Services\Utils;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

class BridgeTwigExtension extends AbstractExtension
{
private $utils ;

public function __construct(Utils $utils)
{
$this->utils = $utils ;
}

public function getFunctions()
{
return array(
new TwigFunction('getDayByNumber', [$this, 'getDayByNumber']),
);
}

public function getFilters()
{
return [
];
}

public function getDayByNumber($number)
{
return $this->utils->getDayByNumber($number) ;
}

}

Loading…
취소
저장