Doctrine 2 overriding many to one association
<p>Is it possible to override <code>@ManyToOne(targetEntity)</code>?</p>

<p>I read <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/override-field-association-mappings-in-subclasses.html" rel="nofollow noreferrer">this Doctrine documentation page</a>, but it doesn't mention how to override <code>targetEntity</code>. </p>

<p>Here's my code:</p>

<pre class="lang-php prettyprint-override"><code>namespace AppBundle\Model\Order\Entity;

use AppBundle\Model\Base\Entity\Identifier;
use AppBundle\Model\Base\Entity\Product;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\AttributeOverrides;
use Doctrine\ORM\Mapping\AttributeOverride;

/**
 * Class OrderItem
 *
 *
 * @ORM\Entity
 * @ORM\Table(name="sylius_order_item")
 * @ORM\AssociationOverrides({
 *      @ORM\AssociationOverride(
 *          name="variant",
 *          joinColumns=@ORM\JoinColumn(
 *              name="variant", referencedColumnName="id", nullable=true
 *          )
 *      )
 * })
 */
class OrderItem extends \Sylius\Component\Core\Model\OrderItem
{

    /**
     * @var
     * @ORM\ManyToOne(targetEntity="AppBundle\Model\Base\Entity\Product")
     */
    protected $product;

    /**
     * @return mixed
     */
    public function getProduct()
    {
        return $this-&gt;product;
    }

    /**
     * @param mixed $product
     */
    public function setProduct($product)
    {
        $this-&gt;product = $product;
    }
}
</code></pre>

<p>I was able to to override the definition for the "variant" column and set this column to null, but I can't figure it out how to change the <code>targetEntity</code>. </p>