[Software Technologies] PHP MVC & Symfony - Calculator
Здравейте, колеги,
Опитвам се да направя калкулатора, показан в лекцията от 19 юли.
Получавам следната грешка:
Type error: Too few arguments to function Symfony\Component\Form\FormRenderer::renderBlock().
Някой да се е сблъсквал с подобно нещо?
<?php namespace AppBundle\Controller; use AppBundle\Form\CalculatorType; use AppBundle\Model\Calculator; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class CalculatorController extends Controller { /** * @Route("/calculator", name="calculator_index") * @return \Symfony\Component\HttpFoundation\Response */ public function indexAction() { $form = $this->createForm(CalculatorType::class); return $this->render("calculator/index.html.twig", [ 'form' => $form->createView() ]); } }
<?php namespace AppBundle\Form; use AppBundle\Model\Calculator; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; class CalculatorType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('firstNumber', NumberType::class) ->add('secondNumber', NumberType::class); } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults( [ 'data_class' => Calculator::class ] ); } public function getBlockPrefix() { return 'app_bundle_calculator_type'; } }
Поздрави,
Веселин
Пробвах и това. Изтрил съм /var/cache и метода getBlockPrefix. Резултата е същия.