camelCaseの自動生成列名を取得するには、explained in Doctrine documentationという命名方法を実装する必要があります。
あなたのカラム名、CamelCaseNamingStrategy.phpためにキャメルケースの名前を取得するには、クラスを作成します。
<?php
class CamelCaseNamingStrategy implements NamingStrategy
{
public function classToTableName($className)
{
return 'cc_' . substr($className, strrpos($className, '\\') + 1);
}
public function propertyToColumnName($propertyName)
{
return $propertyName;
}
public function referenceColumnName()
{
return 'id';
}
public function joinColumnName($propertyName, $className = null)
{
return strtolower($propertyName) . ucwords($this->referenceColumnName());
}
public function joinTableName($sourceEntity, $targetEntity, $propertyName = null)
{
return strtolower($this->classToTableName($sourceEntity)) . ucwords($this->classToTableName($targetEntity));
}
public function joinKeyColumnName($entityName, $referencedColumnName = null)
{
return strtolower($this->classToTableName($entityName)) . ($referencedColumnName ?: ucwords($this->referenceColumnName()));
}
}
次にサービスとして、この新しいクラスを登録し、あなたのconfig.ymlに追加します。
orm:
#...
entity_managers:
default
naming_strategy: my_bundle.camel_case_naming_strategy.default
あなたの質問にお答えできますか? –
* SQL結果の名前を*表示するとどういう意味ですか? – Wilt
大丈夫です。私はより詳細に説明します。私のエンティティ 'TFixed.php'とそれには以下のような内容があります。 '名前空間RestBundle \ Entity; ORMとしてDoctrine \ ORM \ Mappingを使用します。 /** * TFixedFees * * @ORMの\表() * @ORM \エンティティクラスは{ /** をTFixed */ (repositoryClass = "RestBundle \エンティティ\ TFixedRepository")* @var整数 * * @ORMの\列(名= "USER_ID"、タイプ= "整数") */ プライベート$ユーザーID; ' と私は任意のSQLクエリを実行するとき、その結果の配列は{'があります'USER_ID': '67637673'} '。しかし、私はラクダの場合に結果が必要でした。 –