problem about symfony-2.3-Collection of common programming errors


  • zerkms
    php symfony2 symfony-2.3
    Disclaimer:seems like you guys need some real world example for that. So here it is:file_get_contents($filename);Keep in mind about thread safety and race conditions.or any other php notice/warning or any kind of recoverable exception.where either is not defined. And run it in the default app.php with all the default symfony v2.3.5 configs – I seeNotice: Undefined variable: i in /var/www/…/UIBundle/Controller/DeployController.php on line 57Call Stack:0.0000 629696 1. {main}() /var/www/..

  • benatespina
    twig symfony-2.3
    I’m using Symfony 2.3.4 and I have a big bug that I cannot fix. I have tried:composer update -o app/console cache:clear –env=prodand the file exists:vendor/twig/twig/lib/Twig/Extension/Escaper.php Still the bug.Here the error:[Wed Oct 16 11:44:21 2013] [warn] [client 85.93.195.236] mod_fcgid: stderr: PHP Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Unable to load class “Twig_Extension_Escaper”‘ in ../vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassColl

  • artworkad ?
    symfony2 fosuserbundle jmsserializerbundle symfony-2.3
    Basically I want to deserialize json to user object. Like this$serializer = $this->get(‘jms_serializer’);$data = $serializer->deserialize($this->get(‘request’)->getContent(),’My\FooBundle\Entity\User’, ‘json’);The request data passed to deserializer:{“id”:2,”username”:”…@gmail.com”,”username_canonical”:”…@gmail.com”, … }Thrown error:request.CRITICAL: Uncaught PHP ExceptionJMS\Serializer\Exception\RuntimeException: “You must define a type forFOS\UserBundle\Model\User::$username.

  • radke
    php symfony2 http-status-code-404 symfony-2.3
    According to symfony2 documentation NotFoundHttpException should be caught by the framework and ultimately trigger a 404 response, but I’m just getting fatal error (Uncaught exception) with status 200 on prod environment. On dev environment I got 404. I’m using this:throw $this->createNotFoundException();I just want to display my customized 404 page. I’ve cleared cache but it hasn’t helped. Am I doing something wrong?

  • keepitdk
    symfony2 doctrine2 symfony-2.2 fosrestbundle symfony-2.3
    Built an API using Symfony2, FOSRest and Doctrine. Given the following route:”GET /api/path/to/product”And the following parameters:[(“vendorID”, 10), (“destination”, “tanzania”), (“type”, “accommodation”), (“sort”, “price”, “ASC”)]Using FOSRest bundle its possible to retrieve these strings, however, mapping them to doctrine queries is where the challenge arises.I thought about using numerous case statements customised for the different combinations of query strings, not an elegant solution. Wou

  • Bonswouar
    scope block twig symfony-2.3
    I’m trying to customize a specific widget, like in the documentation : http://symfony.com/doc/current/cookbook/form/form_customization.html#how-to-customize-an-individual-fieldThe problem is that in this custom block, I need to use a variable from my actual template. I thought “blocks have access to variables from outer scopes”, but apparently not in this case :{% extends “CDASvBundle::layout.html.twig” %} {% block _contact_activity1_widget %} <select name=”contact[activity1]”>{% for key,

  • Trololololol
    php symfony2 doctrine2 symfony-2.3
    I have 2 Entities/*** @ORM\Entity(repositoryClass=”FLI\ContractBundle\Repository\CarrierFuelRepository”)* @ORM\Table(name=”carrier_fuel”)*/ class CarrierFuel {/*** @ORM\Column(name=”id”, type=”integer”, nullable=false)* @ORM\Id* @ORM\GeneratedValue(strategy=”AUTO”)*/protected $id;/*** @ORM\Column(type=”string”)*/protected $title;/*** @ORM\ManyToOne(targetEntity=”FuelIndex”)*/protected $index;/*** @ORM\OneToMany(targetEntity=”FuelLine”, mappedBy=”carrier_fuel”, cascade={“persist”, “remove”})*/pr

  • Daniel
    php symfony2 error-handling symfony-2.3
    Since I updated my project to Symfony 2.3 php notices don’t throw exceptions any more.I can try to access undefined indexes in arrays and a notice is displayed but no exception is thrown.At first I tought I was confused and maybe this had been the behavior on prvious version. I found some question on stackoverflow that suggest otherwise.how to handle PHP notice in symfony2Is there anyway to make Symfony 2.3 throw exceptions on symfony2 notices?

  • j0k
    symfony2 fosrestbundle symfony-2.3
    I am trying to follow the tutorial ## but am running into an issue. I am receiving the following exception:Call to undefined method Symfony\Component\Config\Definition\Builder\NodeBuilder::fixXmlConfig() in DIR\vendor\jms\serializer-bundle\JMS\SerializerBundle\DependencyInjection\Configuration.php line 46Does anyone know what is going on?I have enabled both required bundles:new JMS\SerializerBundle\JMSSerializerBundle($this), new FOS\RestBundle\FOSRestBundle(),I’m guessing that one of the bundle

  • Reynier
    symfony2 symfony-forms symfony-2.3
    I need to create a deleteForm in my view so I do this:/*** Show created bank account** @Route(“/{account_id}”, name=”wba_show”)* @Method(“GET”)*/ public function showAction($account_id) {$em = $this->getDoctrine()->getManager();$entity = $em->getRepository(‘BankBundle:Account’)->find($account_id);if (!$entity) {throw $this->createNotFoundException(‘Unable to find Account entity.’);}$deleteForm = $this->createDeleteForm($account_id);return array(‘entity’ => $entity, ‘delete_f

Originally posted 2013-11-27 05:10:57.