1

i have a Entity with 2 attributs _obc_id, obc_id

class myEntity {
  ...
  /**
   * @ORM\Column(name="obc_id", type="integer", nullable=false)
   */
  private $obc_id;
  /**
   * @ORM\Column(name="_obc_id", type="integer", nullable=false)
   */
  private $_obc_id;

  public function get_obcId()
  {
    return $this->_obc_id;
  }
  public function getObcId()
  {
    return $this->obc_id;
  }
  public function set_obcId($value);
  {
     $this->_obc_id = $value;
     return $this;
  }
  public function setObcId($value);
  {
     $this->obc_id = $value;
     return $this;
  }
}

Doctrine can't call set_obcId() , get_obcId(), it return 'neither the property nor one of the methods', i write also an __set and __get , but it does'n't work.

Jason Roman
  • 8,146
  • 10
  • 35
  • 40
Zed75
  • 11
  • 3

1 Answers1

0

If you want to use the getters/setters that way, try renaming your variables:

private $obcId;
private $_obcId;

However, I recommend not using 2 column names that are so similar, and not using an underscore at the start of your column name (and consequently not using it in the variable name either).

Jason Roman
  • 8,146
  • 10
  • 35
  • 40