title: how to set column value before persist in symfony2?
body: <p>Suppose I have to set column value formula to 1. So how can I do it before persisting. After persisting I should get 1 in database.</p>
  
  <pre><code> $f=1;
   $product-&gt;setFormula($f);
   $em-&gt;persist($product); 
  </code></pre>
  
  <p>If I use above line it gives an error</p>
  
  <blockquote>
    <p>Expected value of type "Nimo\MrmdBundle\Entity\Product" for
    association field "Nimo\MrmdBundle\Entity\Product#$basedOn", got
    "integer" instead</p>
  </blockquote>
  
  <p>Here is entity code</p>
  
  <pre><code>/**
   * @ORM\ManyToOne(targetEntity="Product")
   * @ORM\JoinColumn(name="formula", referencedColumnName="someothercolumn",nullable=true)
   **/
  private $formula = null;
  </code></pre>