We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyliusRefundPlugin version affected: 1.6
Description
I want to extend the LineItem entity in Sylius Refund Plugin to add a code field. But it's not detected by doctrine
LineItem
code
Steps to reproduce I created a custom entity:
namespace App\Entity\SyliusRefundPlugin; use Doctrine\ORM\Mapping as ORM; use Sylius\RefundPlugin\Entity\LineItem as BaseLineItem; /** * @ORM\Entity * @ORM\Table(name="sylius_refund_line_item") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_refund_line_item')] class LineItem extends BaseLineItem implements LineItemInterface { #[ORM\Column(type: 'string', length: 255, nullable: true)] private ?string $code = null; public function setCode(?string $code): void { $this->code = $code; } public function getCode(): ?string { return $this->code; } }
I also created this interface:
<?php declare(strict_types=1); namespace App\Entity\SyliusRefundPlugin; use Sylius\RefundPlugin\Entity\LineItemInterface as BaseLineItemInterface; interface LineItemInterface extends BaseLineItemInterface { public function getCode(): ?string; public function setCode(?string $code): void; }
Configuration: I used resolve_target_entities in doctrine.yaml:
resolve_target_entities
doctrine.yaml
doctrine: orm: resolve_target_entities: Sylius\RefundPlugin\Entity\LineItem: App\Entity\SyliusRefundPlugin\LineItem
I also added this in services.yaml:
services.yaml
Sylius\RefundPlugin\Entity\LineItem: class: 'App\Entity\SyliusRefundPlugin\LineItem'
Symptoms:
Doctrine recognizes the custom entity:
bin/console doctrine:mapping:info
App\Entity\SyliusRefundPlugin\LineItem
bin/console doctrine:schema:validate
When running a migration with:
bin/console doctrine:migrations:diff
I get the error:
The table with name "chkv3.sylius_refund_line_item" already exists.
To bypass this, I manually wrote the migration to add the code field.
Call to undefined method Sylius\RefundPlugin\Entity\LineItem::setCode()
This indicates that Sylius is still using the base LineItem instance instead of my custom version.
Thanks for your help!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
SyliusRefundPlugin version affected: 1.6
Description
I want to extend the
LineItem
entity in Sylius Refund Plugin to add acode
field. But it's not detected by doctrineSteps to reproduce
I created a custom entity:
I also created this interface:
Configuration:
I used
resolve_target_entities
indoctrine.yaml
:I also added this in
services.yaml
:Symptoms:
Doctrine recognizes the custom entity:
bin/console doctrine:mapping:info
showsApp\Entity\SyliusRefundPlugin\LineItem
bin/console doctrine:schema:validate
shows correct mapping and schema sync.When running a migration with:
I get the error:
To bypass this, I manually wrote the migration to add the
code
field.This indicates that Sylius is still using the base
LineItem
instance instead of my custom version.Thanks for your help!
The text was updated successfully, but these errors were encountered: