Entity from view with float as ID

0

I have the following model:

use Doctrine\ORM\Mapping as ORM;

/**
 * SignosGuion
 *
 * @ORM\Entity
 * @ORM\Table(name="vw_signos_guion")
 */
class SignosGuion {
    /**
     * @var float
     *
     * @ORM\Column(name="id", type="float", nullable=false)
     * @ORM\Id
     */
    private $id;

    /**
     * @var float
     *
     * @ORM\Column(name="codigo", type="float", nullable=false)
     */
    private $codigo;

    // Getters and Setters...
}

This model corresponds to a view in my MySQL database.

When I do

$request = Request::createFromGlobals();
$idSignoGuion = (float) $request->query->get('idSignoGuion');
var_dump($idSignoGuion); // Imprime float(1.05)
$signosGuionRepository = $this->getDoctrine()->getRepository(SignosGuion::class);
$signoGuion = $signosGuionRepository->findOneBy(array('id' => $idSignoGuion));
$signoGuion2 = $signosGuionRepository->find($idSignoGuion);
var_dump($signoGuion); // Imprime NULL
var_dump($signoGuion2); // Imprime NULL

As I said above, both results bring me NULL, I tried:

  • Making the query manually in the DB and working correctly.
  • If I do a findAll () it brings all the elements correctly.
  • If I do not cast Float when I get the get parameter, it gives the same result: NULL.
  • If someone could give me a hand I would appreciate it very much.

        
    asked by Genarito 14.02.2018 в 17:57
    source

    0 answers