Skip to content
Snippets Groups Projects
Commit 1b4c0f57 authored by Jonathan Sacksick's avatar Jonathan Sacksick
Browse files

Issue #3274420 by liquidcms, jsacksick: Update the FeeStorage to account for...

Issue #3274420 by liquidcms, jsacksick: Update the FeeStorage to account for the changes made in the commerce core content entity storage base class.
parent 434c5a81
Branches
No related tags found
No related merge requests found
......@@ -4,18 +4,9 @@ namespace Drupal\commerce_fee;
use Drupal\commerce\CommerceContentEntityStorage;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Defines the fee storage.
......@@ -29,52 +20,13 @@ class FeeStorage extends CommerceContentEntityStorage implements FeeStorageInter
*/
protected $time;
/**
* Constructs a new FeeStorage object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
* @param \Drupal\Core\Database\Connection $database
* The database connection to be used.
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
* The entity field manager.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
* The cache backend to be used.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache
* The memory cache.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time.
*/
public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager, EventDispatcherInterface $event_dispatcher, TimeInterface $time) {
parent::__construct($entity_type, $database, $entity_field_manager, $cache, $language_manager, $memory_cache, $entity_type_bundle_info, $entity_type_manager, $event_dispatcher);
$this->time = $time;
}
/**
* {@inheritdoc}
*/
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static(
$entity_type,
$container->get('database'),
$container->get('entity_field.manager'),
$container->get('cache.entity'),
$container->get('language_manager'),
$container->get('entity.memory_cache'),
$container->get('entity_type.bundle.info'),
$container->get('entity_type.manager'),
$container->get('event_dispatcher'),
$container->get('datetime.time')
);
$instance = parent::createInstance($container, $entity_type);
$instance->time = $container->get('datetime.time');
return $instance;
}
/**
......@@ -92,14 +44,14 @@ class FeeStorage extends CommerceContentEntityStorage implements FeeStorageInter
->condition('order_types', [$order->bundle()], 'IN')
->condition('start_date', $date, '<=')
->condition('status', TRUE)
->condition($or_condition);
->condition($or_condition)
->accessCheck(FALSE);
$result = $query->execute();
if (empty($result)) {
return [];
}
$fees = $this->loadMultiple($result);
return $fees;
return $this->loadMultiple($result);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment