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 

では、doctrine \ symfonyはアンダースコアを食べますか?О.оそして私はそれを列名に使用できませんか?

4

1 に答える 1

3

出口です

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

ここで創業

フィールドにアンダースコアがある場合の Magic Doctrine2 ファインダー?

于 2013-02-07T00:01:15.603 に答える