Hi everyone,
I’m trying to extend the ShopBillingData. This is my class:
<?php
declare(strict_types=1);
namespace MyProject\Model;
use Sylius\Component\Core\Model\ShopBillingData as BaseShopBillingData;
use Sylius\Component\Core\Model\ShopBillingDataInterface;
class ShopBillingData extends BaseShopBillingData implements ShopBillingDataInterface
{
/** @var string */
private $kvkNumber;
/** @var string */
private $bankAccountNumber;
public function getKvkNumber(): ?string
{
return $this->kvkNumber;
}
public function setKvkNumber(string $kvkNumber): void
{
$this->kvkNumber = $kvkNumber;
}
public function getBankAccountNumber(): ?string
{
return $this->bankAccountNumber;
}
public function setBankAccountNumber(string $bankAccountNumber): void
{
$this->bankAccountNumber = $bankAccountNumber;
}
}
I’ve placed doctrine mapping in ShopBillingData.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"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="MyProject\Model\ShopBillingData" table="my_project_shop_billing_data">
<field name="kvkNumber" column="kvk_number" type="string" length="8" nullable="true" />
<field name="bankAccountNumber" column="bank_account_number" type="string" length="34" nullable="true" />
</mapped-superclass>
</doctrine-mapping>
I also created a Form Extension for the corresponding form. When I use the form with its new properties the data is stored in de database, but than i’m seeing the following exception on the channel edit page.
# An exception occurred while executing 'SELECT t1.company AS company_2, t1.tax_id AS tax_id_3, t1.country_code AS country_code_4, t1.street AS street_5, t1.city AS city_6, t1.postcode AS postcode_7, t1.id AS id_8, t1.kvk_number AS kvk_number_9, t1.bank_account_number AS bank_account_number_10 FROM my_project_shop_billing_data t1 WHERE t0.id = ?' with params [1]:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.id' in 'where clause'
I don’t understand why doctrine is using ‘t0’ as table alias in the where clause. Shouldn’t it be just ‘t1’? Does anyone has an idea why this happens?
Thanks in advance!