symfonysymfony-3.4symfony2-easyadmin

Twig_Error_Runtime an exception has been thrown during the rendering of a template


Object of class Proxies__CG__\AppBundle\Entity\Formation could not be converted to float

in vendor\easycorp\easyadmin-bundle\src\Resources\views\default\field_integer.html.twig (line 4)

    {% if field_options.format %}
    {{ field_options.format|format(value) }}
{% else %}
    {{ value|number_format }}
{% endif %}

The error is fixed by commenting out my getters and setters for my foreign key in my entity i'm trying to set them up because they show inaccessible in my easy-admin Bundle

Entity code :

/**
 * Questions
 *
 * @ORM\Table(name="questions", indexes={@ORM\Index(name="question_form_id", columns={"formid"})})
 * @ORM\Entity
 */

/**
 * @var \AppBundle\Entity\Formation
 *
 * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Formation")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="formid", referencedColumnName="Form_id")
 * })
 */
private $formid;

getters and setters :

/**
 * @return Formation
 */
public function getFormid()
{
    return $this->formid;
}

/**
 * @param Formation $formid
 */
public function setFormid($formid)
{
    $this->formid = $formid;
}

Solution

  • Fixed it, the @param was using the wrong column, sorry.