0

简单的例子,我们有

/**
 * @ORM\Column(name="api_keyID", type="integer", nullable=false)
 */
private $api_keyID;

  /**
 * @return integer 
 */
public function getApi_keyID()
{
    return $this->api_keyID;
}

/**
 * @param integer $api_keyID
 * @return object
 */
public function setApi_keyID($data)
{
    $this->api_keyID = $data;

    return $this;
}

查看方法名称和列名称。当我尝试

//...
   ->findOneByApi_keyID($some);

我收到一个错误,例如

Entity 'entity\path' has no field 'apiKeyID'. You can therefore not call 'findOneByApi_keyID' on the entities' repository 

所以学说\symfony 吃下划线?О.о 而且我不能在列名中使用它?

4

1 回答 1

3

是出路

$repository->findBy(array('is_enabled' => true));

在这里成立

当字段有下划线时,Magic Doctrine2 finders?

于 2013-02-07T00:01:15.603 回答