I'm getting this error when executing doctrine:migrations:diff
[Doctrine\DBAL\Schema\SchemaException] There is no column with name
'brand' on table 'customer'.
This is the previous migration I've made. I did it manually because
doctrine:migrations:diff was creating no migration
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
class Version20160711123625 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !=
'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE customer CHANGE brand brand_id SMALLINT NOT
NULL');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !=
'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE customer CHANGE brand_id brand SMALLINT NOT
NULL');
}
}
The migration was done because of brand attribute need to be hydrated as
BranIdVO.
Customer.orm.xml
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Component\Customer\Domain\Model\Customer" table="customer"
repository-class="GAT\CustomerBundle\Infrastructure\DoctrineCustomerRepository">
<unique-constraints>
<unique-constraint columns="email,brand,version_status"/>
</unique-constraints>
<id name="id" type="string" column="id" length="36">
<generator strategy="NONE"/>
</id>
<field name="email" type="string" column="email" length="255"
nullable="false"/>
<field name="type" type="smallint" column="type" length="1"
nullable="false"/>
<field name="password" type="string" column="password" length="255"
nullable="true"/>
<field name="versionStatus" type="smallint" column="version_status"
length="1" nullable="false"/>
<field name="firstName" type="string" column="first_name" length="96"
nullable="true"/>
<field name="lastName" type="string" column="last_name" length="255"
nullable="true"/>
<field name="legalId" type="string" column="legal_id" length="24"
nullable="true"/>
<field name="gender" type="string" column="gender" length="1"
nullable="true"/>
<field name="birthdate" type="date" column="birthdate" nullable="true"/>
<field name="phoneNumber" type="string" column="telephone" length="24"
nullable="true"/>
<field name="creationChannel" type="string" column="creation_channel"
length="2" nullable="false"/>
<field name="marketingLead" type="string" column="marketing_lead"
length="255" nullable="true"/>
<field name="createdAt" type="datetime" column="created_at"
nullable="false"/>
<field name="updatedAt" type="datetime" column="updated_at"
nullable="false"/>
<field name="salt" type="string" column="salt" nullable="true"/>
<field name="facebookId" type="string" column="facebook_id"
nullable="true"/>
<embedded name="brand" class="Component\Core\Domain\Model\BrandIdVO"
use-column-prefix="false"/>
</entity>
</doctrine-mapping>
BrandIdVO.orm.xml
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Component\Core\Domain\Model\BrandIdVO">
<field name="id" column="brand_id" type="smallint" length="2"/>
</embeddable>
</doctrine-mapping>
Customer.php
class Customer implements UserInterface, AdvancedUserInterface, \Serializable,
EquatableInterface
{
use TimestampableTrait;
/** @var CustomerIdVO */
protected $id;
/** @var EmailVO */
protected $email;
/** @var BrandIdVO */
protected $brand;
/** @var CustomerTypeVO */
protected $type;
/** @var EncryptedPasswordVO */
protected $password;
/** @var integer */
protected $versionStatus;
/** @var string */
protected $firstName;
/** @var string */
protected $lastName;
/** @var string */
protected $legalId;
/** @var GenderVO */
protected $gender;
/** @var \DateTime */
protected $birthdate;
/** @var PhoneNumberVO */
protected $phoneNumber;
/** @var integer */
protected $feature;
/** @var ChannelIdVO */
protected $creationChannel;
/** @var string */
protected $marketingLead;
/** @var string */
protected $salt;
/** @var bool */
protected $isActive;
/** @var string */
protected $facebookId;
Everything looks fine to me, so I must be shortsighted. Any help would be
greatly appreciated.
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.