title: Notice: Object of class Doctrine\ORM\EntityManager could not be converted to int
body: <p>I stumbled upon this error while trying to update an object and can't find any explanation. Here is my code:</p>
  
  <p>Entity</p>
  
  <pre><code>    namespace Mnv\CoreBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * Class UtilitatiVariabile
   * @package Mnv\CoreBundle\Entity
   *
   * @ORM\Table(name="utilitati_variabile")
   * @ORM\Entity(repositoryClass="Mnv\CoreBundle\Entity\Repository\UtilitatiVariabileRepository")
   */
  class UtilitatiVariabile {
  
      /**
       * @var integer
       *
       * @ORM\Id()
       * @ORM\GeneratedValue(strategy="AUTO")
       * @ORM\Column(type="integer")
       */
      protected $id;
  
      /**
       * @var float
       *
       * @ORM\Column(type="decimal", precision=10, scale=6, nullable=true)
       */
      protected $coeficient;
  
      /**
       * @var float
       *
       * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $kwh;
  
      /**
       * @var float
       *
       * @ORM\Column(name="original_kwh", type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $originalKwh;
  
      /**
       * @var float
       *
       * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $mc;
  
      /**
       * @var float
       *
       * @ORM\Column(name="original_mc", type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $originalMc;
  
      /**
       * @var float
       *
       * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $lei;
  
      /**
       * @var float
       *
       * @ORM\Column(name="original_lei", type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $originalLei;
  
      /**
       * @var float
       *
       * @ORM\Column(type="decimal", precision=10, scale=6, nullable=true)
       */
      protected $leikw;
  
      /**
       * @var float
       *
       * @ORM\Column(type="decimal", precision=10, scale=6, nullable=true)
       */
      protected $leimc;
  
      /**
       * @var float
       *
       * @ORM\Column(name="suprafata_totala", type="decimal", precision=10, scale=2, nullable=true)
       */
      protected $suprafataTotala;
  
      /**
       * @var float
       *
       * @ORM\Column(name="total_col_mc", type="decimal", precision=20, scale=2, nullable=true)
       */
      protected $totalColMc;
  
      /**
       * @var float
       *
       * @ORM\Column(name="total_col_kwh", type="decimal", precision=20, scale=2, nullable=true)
       */
      protected $totalColKwh;
  
      /**
       * @var float
       *
       * @ORM\Column(name="total_col_lei", type="decimal", precision=20, scale=2, nullable=true)
       */
      protected $totalColLei;
  
      /**
       * @var float
       *
       * @ORM\Column(name="total_col_total", type="decimal", precision=20, scale=2, nullable=true)
       */
      protected $totalColTotal;
  
      /**
       * @var Utilitati
       *
       * @ORM\ManyToOne(targetEntity="Utilitati")
       * @ORM\JoinColumn(name="id_utilitate", referencedColumnName="id", onDelete="SET NULL")
       */
      protected $utilitate;
  
      /**
       * @var SesiuneUtilitati
       *
       * @ORM\ManyToOne(targetEntity="SesiuneUtilitati")
       * @ORM\JoinColumn(name="id_sesiune", referencedColumnName="id", onDelete="CASCADE")
       */
      protected $sesiuneUtilitati;
  </code></pre>
  
  <p>And i tried to update like this in my controller:</p>
  
  <pre><code>$variables = $this-&gt;getVariabileRepository()-&gt;find(1);
  $variables-&gt;setKwh($kwh);
          .
          .
          .
          $em = $this-&gt;getEntityManager();
          $em-&gt;persist($variables);
          $em-flush();
  
  
  
  
     protected function getEntityManager()
          {
              return $this-&gt;getDoctrine()-&gt;getManager();
          }
  
      protected function getVariabileRepository()
      {
          return $this-&gt;getEntityManager()-&gt;getRepository('MnvCoreBundle:UtilitatiVariabile');
      }
  </code></pre>
  
  <p>I did the same with other entities and no problem, i don't know what is wrong with this one. I validated doctrine schema, nothing wrong there.</p>