I'm converting my Zend Framework 1 app into a Laravel App. I was using Doctrine so I moved the models to Laravel. I am using laravel-doctrine
The fields are written in camelCase and when the database was created through doctrine, they were also created in camelCase, like this:
/**
* @ORM\Entity (repositoryClass="Repositories\Customer")
* @ORM\Table(name="customers")
* @ORM\HasLifecycleCallbacks
*/
class Customer
{
/**
* @ORM\Id @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/** @ORM\Column(type="string", length=255, nullable=true) */
protected $firstName;
/** @ORM\Column(type="string", length=255, nullable=true) */
protected $lastName;
/** @ORM\Column(type="string", length=255, nullable=true) */
protected $companyName;
When I do EntityManager::find('App\Entities\Customer', 1);
I get this error:
An exception occurred while executing 'SELECT t0.id AS id_1, t0.firstName AS firstName_2, t0.lastName AS lastName_3, t0.company_name AS company_name_4, t0.email AS email_5, t0.phone_number AS phone_number_6, t0.type AS type_7, t0.created AS created_8, t0.updated AS updated_9, t0.jobsource_id AS jobsource_id_10 FROM customers t0 WHERE t0.id = ?' with params 1: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.company_name' in 'field list'
Is there a reason why is looking for underscore? Is there a way for me to change that?
I am using PHP 7.0.1
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire