Skip to content

2922811 - Deprecate Commerce's BundleFieldDefinition, BundlePluginInterface #828

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

Closed
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
2 changes: 1 addition & 1 deletion modules/order/commerce_order.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Defines the Order entity and associated features.
*/

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\commerce_order\Entity\OrderTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\commerce_payment\Plugin\Commerce\PaymentMethodType;

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\commerce_payment\CreditCard as CreditCardHelper;
use Drupal\commerce_payment\Entity\PaymentMethodInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\commerce_payment\Plugin\Commerce\PaymentMethodType;

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\commerce_payment\Entity\PaymentMethodInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\commerce_payment\Plugin\Commerce\PaymentMethodType;

use Drupal\commerce\BundlePluginInterface;
use Drupal\entity\BundlePlugin\BundlePluginInterface;
use Drupal\commerce_payment\Entity\PaymentMethodInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\commerce_payment\Plugin\Commerce\PaymentType;

use Drupal\commerce\BundlePluginInterface;
use Drupal\entity\BundlePlugin\BundlePluginInterface;

/**
* Defines the interface for payment types.
Expand Down
2 changes: 1 addition & 1 deletion modules/product/commerce_product.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Defines the Product entity and associated features.
*/

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\commerce_product\Entity\ProductTypeInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Form\FormStateInterface;
Expand Down
4 changes: 4 additions & 0 deletions src/BundleFieldDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

namespace Drupal\commerce;

@trigger_error('The ' . __NAMESPACE__ . '\BundleFieldDefinition is deprecated. Instead, use \Drupal\entity\BundleFieldDefinition', E_USER_DEPRECATED);

use Drupal\entity\BundleFieldDefinition as BaseBundleFieldDefinition;

/**
* Provides a field definition class for bundle fields.
*
* Note: This code has moved to Entity API, see the parent class.
*
* @deprecated in Commerce 2.0
*/
class BundleFieldDefinition extends BaseBundleFieldDefinition {}
4 changes: 4 additions & 0 deletions src/BundlePluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

namespace Drupal\commerce;

@trigger_error('The ' . __NAMESPACE__ . '\BundlePluginInterface is deprecated. Instead, use \Drupal\entity\BundlePlugin\BundlePluginInterface', E_USER_DEPRECATED);

use Drupal\entity\BundlePlugin\BundlePluginInterface as BaseBundlePluginInterface;

/**
* Interface for plugins which act as entity bundles.
*
* Note: This code has moved to Entity API, see the parent class.
*
* @deprecated in Commerce 2.0
*/
interface BundlePluginInterface extends BaseBundlePluginInterface {}
1 change: 1 addition & 0 deletions src/ConfigurableFieldManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\entity\BundleFieldDefinition;

class ConfigurableFieldManager implements ConfigurableFieldManagerInterface {

Expand Down
8 changes: 5 additions & 3 deletions src/ConfigurableFieldManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Drupal\commerce;

use Drupal\entity\BundleFieldDefinition;

/**
* Manages configurable fields based on field definitions.
*
Expand All @@ -12,7 +14,7 @@ interface ConfigurableFieldManagerInterface {
/**
* Creates a configurable field from the given field definition.
*
* @param \Drupal\commerce\BundleFieldDefinition $field_definition
* @param \Drupal\entity\BundleFieldDefinition $field_definition
* The field definition.
* @param bool $lock
* Whether the created field should be locked.
Expand All @@ -28,7 +30,7 @@ public function createField(BundleFieldDefinition $field_definition, $lock = TRU
/**
* Deletes the configurable field created from the given field definition.
*
* @param \Drupal\commerce\BundleFieldDefinition $field_definition
* @param \Drupal\entity\BundleFieldDefinition $field_definition
* The field definition.
*
* @throws \InvalidArgumentException
Expand All @@ -42,7 +44,7 @@ public function deleteField(BundleFieldDefinition $field_definition);
/**
* Checks whether the configurable field has data.
*
* @param \Drupal\commerce\BundleFieldDefinition $field_definition
* @param \Drupal\entity\BundleFieldDefinition $field_definition
* The field definition.
*
* @return bool
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Commerce/EntityTrait/EntityTraitInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getEntityTypeIds();
* THe provided field definitions will be created as configurable
* fields when the entity trait is installed for an entity type/bundle.
*
* @return \Drupal\commerce\BundleFieldDefinition[]
* @return \Drupal\entity\BundleFieldDefinition[]
* An array of field definitions, keyed by field name.
*/
public function buildFieldDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\commerce_test\Plugin\Commerce\EntityTrait;

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitBase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\commerce_test\Plugin\Commerce\EntityTrait;

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitBase;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/ConfigurableFieldManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Drupal\Tests\commerce\Kernel;

use Drupal\commerce\BundleFieldDefinition;
use Drupal\entity\BundleFieldDefinition;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;

Expand Down