wip
This commit is contained in:
parent
3d6809830c
commit
fe9820ef4b
7 changed files with 253 additions and 234 deletions
|
@ -36,6 +36,9 @@
|
|||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
<Configuration>
|
||||
<option name="path" value="$PROJECT_DIR$/tests" />
|
||||
</Configuration>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
<PhpSpecSuiteConfiguration>
|
||||
<option name="myPath" value="$PROJECT_DIR$" />
|
||||
</PhpSpecSuiteConfiguration>
|
||||
</suites>
|
||||
</component>
|
||||
</project>
|
434
composer.lock
generated
434
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
|||
use App\Entity\FoodOrder;
|
||||
use App\Entity\MenuItem;
|
||||
use App\Entity\OrderItem;
|
||||
use App\Form\MenuItemExtraType;
|
||||
use App\Form\OrderItemType;
|
||||
use App\Repository\ItemExtraRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -88,10 +89,18 @@ class FoodOrderController extends AbstractController
|
|||
);
|
||||
}
|
||||
|
||||
return $this->render('food_order/orderitem.html.twig', [
|
||||
'form' => $form,
|
||||
'extras' => $extraRepository->getUniqueNames(),
|
||||
]);
|
||||
$formExtra = $this->createForm(
|
||||
MenuItemExtraType::class,
|
||||
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
'food_order/orderitem.html.twig',
|
||||
[
|
||||
'form' => $form,
|
||||
'extras' => $extraRepository->getUniqueNames(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\ItemExtra;
|
||||
use App\Entity\MenuItem;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Override;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
@ -12,18 +12,25 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
class MenuItemExtraType extends AbstractType
|
||||
{
|
||||
#[Override]
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name');
|
||||
$builder->add('customextra', TextType::class, [
|
||||
'label' => 'Add a new extra option',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'attr' => ['list' => 'item-extra-list'],
|
||||
]);
|
||||
$builder->add('name');
|
||||
$builder->add(
|
||||
'customextra',
|
||||
TextType::class,
|
||||
[
|
||||
'label' => 'Add a new extra option',
|
||||
'mapped' => false,
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'list' => 'item-extra-list',
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
|
|
|
@ -8,7 +8,6 @@ use App\Entity\OrderItem;
|
|||
use Override;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
|
|
|
@ -26,9 +26,7 @@ class ItemExtraRepository extends ServiceEntityRepository
|
|||
public function getUniqueNames(): Collection
|
||||
{
|
||||
$qb = $this->createQueryBuilder('p');
|
||||
|
||||
$qb->groupBy('p.name');
|
||||
|
||||
return new ArrayCollection($qb->getQuery()->getResult());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue