Skip to content
New issue

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

Support both anotations and attributes for doctrine #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,29 @@

/yarn-error.log
/supervisord.log

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "^1.11|^1.12"
"sylius/sylius": "^1.11"
},
"require-dev": {
"behat/behat": "^3.9.0",
Expand Down
5 changes: 5 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@
<!-- Delivery is disabled by default via "null://localhost" -->
<env name="MAILER_URL" value="null://localhost"/>
<!-- ###- symfony/swiftmailer-bundle ### -->

<!-- ###+ symfony/framework-bundle ### -->
<env name="APP_ENV" value="dev"/>
<env name="APP_SECRET" value="d07ffb5793aff8038b79702ca85472b1"/>
<!-- ###- symfony/framework-bundle ### -->
</php>
</phpunit>
4 changes: 2 additions & 2 deletions src/Model/PaymentMethodWithFeeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ interface PaymentMethodWithFeeInterface extends PaymentMethodInterface, TaxableI
public function getCalculator(): ?string;

/**
* @return array<mixed>
* @return array<string, mixed>
*/
public function getCalculatorConfiguration(): array;

public function setTaxCategory(?TaxCategoryInterface $category): void;
public function setTaxCategory(?TaxCategoryInterface $taxCategory): void;
}
5 changes: 5 additions & 0 deletions src/Model/PaymentMethodWithFeeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@

namespace ThreeBRS\SyliusPaymentFeePlugin\Model;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Taxation\Model\TaxCategoryInterface;

trait PaymentMethodWithFeeTrait
{
/** @ORM\Column(name="calculator", type="text", nullable=true) */
#[ORM\Column(name: 'calculator', type: Types::TEXT, nullable: true)]
protected ?string $calculator = null;

/**
* @ORM\ManyToOne(targetEntity="Sylius\Component\Taxation\Model\TaxCategoryInterface")
*
* @ORM\JoinColumn(name="tax_category_id")
*/
#[ORM\ManyToOne(targetEntity: TaxCategoryInterface::class)]
#[ORM\JoinColumn(name: 'tax_category_id')]
protected ?TaxCategoryInterface $taxCategory = null;

/** @ORM\Column(name="calculator_configuration", type="json", nullable=true) */
#[ORM\Column(name: 'calculator_configuration', type: 'json', nullable: true)]
protected array $calculatorConfiguration = [];

public function getCalculator(): ?string
Expand Down