{"action":"closed","issue":{"url":"https://api.github.com/repos/laravel-doctrine/orm/issues/65","labels_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/65/comments","events_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/65/events","html_url":"https://github.com/laravel-doctrine/orm/issues/65","id":109998466,"number":65,"title":"Strange doctrine behaviour. Wrong column names in SQL","user":{"login":"erro1","id":11589437,"avatar_url":"https://avatars.githubusercontent.com/u/11589437?v=3","gravatar_id":"","url":"https://api.github.com/users/erro1","html_url":"https://github.com/erro1","followers_url":"https://api.github.com/users/erro1/followers","following_url":"https://api.github.com/users/erro1/following{/other_user}","gists_url":"https://api.github.com/users/erro1/gists{/gist_id}","starred_url":"https://api.github.com/users/erro1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erro1/subscriptions","organizations_url":"https://api.github.com/users/erro1/orgs","repos_url":"https://api.github.com/users/erro1/repos","events_url":"https://api.github.com/users/erro1/events{/privacy}","received_events_url":"https://api.github.com/users/erro1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-06T12:35:09Z","updated_at":"2015-10-20T16:54:26Z","closed_at":"2015-10-20T16:54:26Z","body":"Hello.\r\nMy problem is the strange behaviour of Doctrine. If i use the facade EntityManager in\r\n```PHP\r\n    $dql = \"SELECT h.houseID, h.areaID,\r\n                  h.name, h.address,\r\n                  h.beds, h.baths,\r\n                  h.sqft, h.year,\r\n                  h.rent, h.price\r\n                FROM \" . App\\Model\\EnumEntities::ENT_HOUSE . \" h\";\r\n    $res = EntityManager::createQuery($dql)->getResult();\r\n    return json_encode(array('data' => $res));\r\n```\r\ni get the exception:\r\n```\r\nInvalidFieldNameException in AbstractMySQLDriver.php line 71:\r\nAn exception occurred while executing 'SELECT m0_.house_i_d AS house_i_d_0, m0_.area_i_d AS area_i_d_1, m0_.name AS name_2, m0_.address AS address_3, m0_.beds AS beds_4, m0_.baths AS baths_5, m0_.sqft AS sqft_6, m0_.year AS year_7, m0_.rent AS rent_8, m0_.price AS price_9 FROM mx_houses m0_':\r\n\r\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'm0_.house_i_d' in 'field list'\r\n```\r\nDoctrine uses wrong names of columns with \"ID\". However, if i set up EntityManager myself, it will work properly\r\n```php\r\n        $dbParams = array(\r\n            'driver'   \t=> DBManager::DRIVER,\r\n            'host'\t\t=> DBManager::HOST,\r\n            'user'     \t=> DBManager::USER,\r\n            'password' \t=> DBManager::PASSWORD,\r\n            'dbname'   \t=> DBManager::DBNAME,\r\n        );\r\n        $this->config = Setup::createAnnotationMetadataConfiguration(array(base_path(\"app/Model\")), true);\r\n        $this->entityManager = EntityManager::create($dbParams, $this->config);\r\n```\r\nHere is doctrine default manager basic config\r\n```php\r\n'managers'                  => [\r\n        'default' => [\r\n            'dev'        => env('APP_DEBUG', false),\r\n            'meta'       => env('DOCTRINE_METADATA', 'annotations'),\r\n            'connection' => env('DB_CONNECTION', 'mysql'),\r\n            'namespaces' => [\r\n                'App/Model'\r\n            ],\r\n            'paths'      => [\r\n                base_path(\"app/Model\")\r\n            ],\r\n            'repository' => Doctrine\\ORM\\EntityRepository::class,\r\n            'proxies'    => [\r\n                'namespace'     => false,\r\n                'path'          => storage_path('proxies'),\r\n                'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)\r\n            ],\r\n    ],\r\n```\r\nand entity\r\n```php\r\nnamespace App\\Model;\r\nuse Doctrine\\ORM\\Mapping\\Column,\r\n    Doctrine\\ORM\\Mapping\\Id,\r\n    Doctrine\\ORM\\Mapping\\Entity,\r\n    Doctrine\\ORM\\Mapping\\Table,\r\n    Doctrine\\ORM\\Mapping\\GeneratedValue,\r\n    Doctrine\\ORM\\Mapping\\JoinColumn,\r\n    Doctrine\\ORM\\Mapping\\OneToOne;\r\n\r\n/**\r\n * @Entity\r\n * @Table(name=\"mx_houses\")\r\n **/\r\nclass House\r\n{\r\n    /**\r\n     * @Id\r\n     * @Column(type=\"integer\")\r\n     * @GeneratedValue(strategy=\"AUTO\")\r\n     * @var int\r\n     **/\r\n    protected $houseID;\r\n\r\n    /**\r\n     * @Column(type=\"integer\")\r\n     * @var int\r\n     **/\r\n    protected $areaID;\r\n\r\n    /**\r\n     * @Column(type=\"string\", length=100)\r\n     * @var string\r\n     **/\r\n    protected $name;\r\n\r\n    /**\r\n     * @Column(type=\"string\", length=255)\r\n     * @var string\r\n     **/\r\n    protected $address;\r\n\r\n    /**\r\n     * @Column(type=\"string\", length=5)\r\n     * @var string\r\n     **/\r\n    protected $beds;\r\n\r\n    /**\r\n     * @Column(type=\"string\", length=5)\r\n     * @var string\r\n     **/\r\n    protected $baths;\r\n\r\n    /**\r\n     * @Column(type=\"smallint\")\r\n     * @var int\r\n     **/\r\n    protected $sqft;\r\n\r\n    /**\r\n     * @Column(columnDefinition=\"YEAR\", nullable=false)\r\n     * @var string\r\n     **/\r\n    protected $year;\r\n\r\n    /**\r\n     * @Column(type=\"smallint\")\r\n     * @var int\r\n     **/\r\n    protected $rent;\r\n\r\n    /**\r\n     * @Column(type=\"integer\")\r\n     * @var int\r\n     **/\r\n    protected $price;\r\n```"}}