Skip to content

Commit

Permalink
refactor #865 [Maintenance] Annotation changed to PHP Attributes in t…
Browse files Browse the repository at this point in the history
…he Entity classes (Rafikooo)

This PR was merged into the 1.12 branch.

Discussion
----------

Since we do not use PHP 7.4 anymore, it's preferable to move into PHP Attributes

Commits
-------

5ff63c4 [Maintenance] Annotation changed to PHP Attributes in the Entity classes
1f70b15 [Maintenance] Doctrine configuration changed to use PHP Attributes instead of annotations
  • Loading branch information
coldic3 authored Nov 3, 2022
2 parents 76ef08a + 1f70b15 commit cee8e20
Show file tree
Hide file tree
Showing 59 changed files with 117 additions and 233 deletions.
2 changes: 1 addition & 1 deletion config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ doctrine:
mappings:
App:
is_bundle: false
type: annotation
type: attribute
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Address as BaseAddress;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_address")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_address')]
class Address extends BaseAddress
{
}
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Addressing\Model\Country as BaseCountry;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_country")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_country')]
class Country extends BaseCountry
{
}
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Province.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Addressing\Model\Province as BaseProvince;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_province")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_province')]
class Province extends BaseProvince
{
}
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Zone.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Addressing\Model\Zone as BaseZone;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_zone")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_zone')]
class Zone extends BaseZone
{
}
6 changes: 2 additions & 4 deletions src/Entity/Addressing/ZoneMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Addressing\Model\ZoneMember as BaseZoneMember;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_zone_member")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_zone_member')]
class ZoneMember extends BaseZoneMember
{
}
6 changes: 2 additions & 4 deletions src/Entity/Channel/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Channel as BaseChannel;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_channel")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_channel')]
class Channel extends BaseChannel
{
}
6 changes: 2 additions & 4 deletions src/Entity/Channel/ChannelPricing.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\ChannelPricing as BaseChannelPricing;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_channel_pricing")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_channel_pricing')]
class ChannelPricing extends BaseChannelPricing
{
}
6 changes: 2 additions & 4 deletions src/Entity/Currency/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Currency\Model\Currency as BaseCurrency;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_currency")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_currency')]
class Currency extends BaseCurrency
{
}
6 changes: 2 additions & 4 deletions src/Entity/Currency/ExchangeRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Currency\Model\ExchangeRate as BaseExchangeRate;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_exchange_rate")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_exchange_rate')]
class ExchangeRate extends BaseExchangeRate
{
}
6 changes: 2 additions & 4 deletions src/Entity/Customer/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Customer as BaseCustomer;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_customer")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_customer')]
class Customer extends BaseCustomer
{
}
6 changes: 2 additions & 4 deletions src/Entity/Customer/CustomerGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Customer\Model\CustomerGroup as BaseCustomerGroup;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_customer_group")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_customer_group')]
class CustomerGroup extends BaseCustomerGroup
{
}
6 changes: 2 additions & 4 deletions src/Entity/Locale/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Locale\Model\Locale as BaseLocale;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_locale")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_locale')]
class Locale extends BaseLocale
{
}
6 changes: 2 additions & 4 deletions src/Entity/Order/Adjustment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Adjustment as BaseAdjustment;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_adjustment")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_adjustment')]
class Adjustment extends BaseAdjustment
{
}
6 changes: 2 additions & 4 deletions src/Entity/Order/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Order as BaseOrder;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_order")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_order')]
class Order extends BaseOrder
{
}
6 changes: 2 additions & 4 deletions src/Entity/Order/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\OrderItem as BaseOrderItem;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_order_item")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_order_item')]
class OrderItem extends BaseOrderItem
{
}
6 changes: 2 additions & 4 deletions src/Entity/Order/OrderItemUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\OrderItemUnit as BaseOrderItemUnit;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_order_item_unit")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_order_item_unit')]
class OrderItemUnit extends BaseOrderItemUnit
{
}
6 changes: 2 additions & 4 deletions src/Entity/Order/OrderSequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\OrderSequence as BaseOrderSequence;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_order_sequence")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_order_sequence')]
class OrderSequence extends BaseOrderSequence
{
}
6 changes: 2 additions & 4 deletions src/Entity/Payment/GatewayConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Bundle\PayumBundle\Model\GatewayConfig as BaseGatewayConfig;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_gateway_config")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_gateway_config')]
class GatewayConfig extends BaseGatewayConfig
{
}
6 changes: 2 additions & 4 deletions src/Entity/Payment/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Payment as BasePayment;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_payment")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment')]
class Payment extends BasePayment
{
}
6 changes: 2 additions & 4 deletions src/Entity/Payment/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
use Sylius\Component\Core\Model\PaymentMethod as BasePaymentMethod;
use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_payment_method")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment_method')]
class PaymentMethod extends BasePaymentMethod
{
protected function createTranslation(): PaymentMethodTranslationInterface
Expand Down
6 changes: 2 additions & 4 deletions src/Entity/Payment/PaymentMethodTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Payment\Model\PaymentMethodTranslation as BasePaymentMethodTranslation;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_payment_method_translation")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment_method_translation')]
class PaymentMethodTranslation extends BasePaymentMethodTranslation
{
}
6 changes: 2 additions & 4 deletions src/Entity/Payment/PaymentSecurityToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Bundle\PayumBundle\Model\PaymentSecurityToken as BasePaymentSecurityToken;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_payment_security_token")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment_security_token')]
class PaymentSecurityToken extends BasePaymentSecurityToken
{
}
6 changes: 2 additions & 4 deletions src/Entity/Product/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
use Sylius\Component\Core\Model\Product as BaseProduct;
use Sylius\Component\Product\Model\ProductTranslationInterface;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product')]
class Product extends BaseProduct
{
protected function createTranslation(): ProductTranslationInterface
Expand Down
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductAssociation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Product\Model\ProductAssociation as BaseProductAssociation;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_association")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_association')]
class ProductAssociation extends BaseProductAssociation
{
}
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductAssociationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
use Sylius\Component\Product\Model\ProductAssociationType as BaseProductAssociationType;
use Sylius\Component\Product\Model\ProductAssociationTypeTranslationInterface;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_association_type")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_association_type')]
class ProductAssociationType extends BaseProductAssociationType
{
protected function createTranslation(): ProductAssociationTypeTranslationInterface
Expand Down
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductAssociationTypeTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Product\Model\ProductAssociationTypeTranslation as BaseProductAssociationTypeTranslation;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_association_type_translation")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_association_type_translation')]
class ProductAssociationTypeTranslation extends BaseProductAssociationTypeTranslation
{
}
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
use Sylius\Component\Attribute\Model\AttributeTranslationInterface;
use Sylius\Component\Product\Model\ProductAttribute as BaseProductAttribute;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_attribute")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_attribute')]
class ProductAttribute extends BaseProductAttribute
{
protected function createTranslation(): AttributeTranslationInterface
Expand Down
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductAttributeTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Product\Model\ProductAttributeTranslation as BaseProductAttributeTranslation;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_attribute_translation")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_attribute_translation')]
class ProductAttributeTranslation extends BaseProductAttributeTranslation
{
}
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductAttributeValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Product\Model\ProductAttributeValue as BaseProductAttributeValue;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_attribute_value")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_attribute_value')]
class ProductAttributeValue extends BaseProductAttributeValue
{
}
6 changes: 2 additions & 4 deletions src/Entity/Product/ProductImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\ProductImage as BaseProductImage;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_image")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_product_image')]
class ProductImage extends BaseProductImage
{
}
Loading

0 comments on commit cee8e20

Please sign in to comment.