Skip to content
Snippets Groups Projects
Commit 3e6b7add authored by git's avatar git
Browse files

Fixes syntax and reference errors

Fixes MappedObject to use Entity constructor params instead of
ConfigEntity constructor params
parent e280a846
No related branches found
No related tags found
No related merge requests found
......@@ -15,5 +15,4 @@ services:
salesforce.mapped_object_storage:
class: Drupal\salesforce_mapping\MappedObjectStorage
arguments: ['mapped_object', "@database", "@entity.manager", "@cache.backend.database", "@language_manager"]
arguments: ['salesforce_mapped_object', "@database", "@entity.manager", "@cache.backend.database", "@language_manager"]
......@@ -2,9 +2,9 @@
namespace Drupal\salesforce_mapping;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\DatabaseBackendFactory;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
......@@ -22,40 +22,22 @@ class MappedObjectStorage extends SqlContentEntityStorage {
use ThrowsOnLoadTrait;
/**
* Drupal\Core\Config\ConfigFactory definition.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Drupal\Component\Uuid\Php definition.
*
* @var \Drupal\Component\Uuid\UuidInterface
*/
protected $uuidService;
/**
* Drupal\Core\Language\LanguageManager definition.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Drupal\Core\Entity\EntityManager definition.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* {@inheritdoc}
*/
public function __construct($entity_type_id, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, EntityManagerInterface $entity_manager) {
$entity_type = $entity_manager->getDefinition($entity_type_id);
parent::__construct($entity_type, $config_factory, $uuid_service, $language_manager);
// During testing, complaints alternate between the type of
// cache interface expected between below:
// CacheBackendInterface
// DatabaseBackendFactory
public function __construct($entity_type_id, Connection $database, EntityManagerInterface $entity_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager) {
// @TODO the $entity_type needs to be in the constructor and not
// devrived from from $entity_type_id. This is because of the parent
// class SqlContentEntityStorage's createInstance method, which while
// ultimately calls it's own constructer through here, is calling this
// constuctor with the same paramter blueprint, which expects
// EntityTypeInterface and not a string.
$entity_type = $entity_manager->getDefinition('salesforce_mapped_object');
parent::__construct($entity_type, $database, $entity_manager, $cache, $language_manager);
}
/**
......
......@@ -73,7 +73,7 @@ abstract class PullBase extends QueueWorkerBase implements ContainerFactoryPlugi
*
* @var MappedObjectStorage
*/
protected $mapped_object_storage
protected $mapped_object_storage;
/**
* Creates a new PullBase object.
......
......@@ -50,7 +50,7 @@ class PushQueue extends DatabaseQueue {
*
* @var MappedObjectStorage
*/
protected $mapped_object_storage
protected $mapped_object_storage;
/**
* Constructs a \Drupal\Core\Queue\DatabaseQueue object.
......@@ -139,7 +139,7 @@ class PushQueue extends DatabaseQueue {
}
/**
* Claim up to $n items from the current queue.
* Claim up to $n items from the current queue.
* If queue is empty, return an empty array.
* @see DatabaseQueue::claimItem
* @return array $items
......@@ -149,7 +149,7 @@ class PushQueue extends DatabaseQueue {
while (TRUE) {
try {
// @TODO: convert items to content entities.
// @see \Drupal::entityQuery()
// @see \Drupal::entityQuery()
$items = $this->connection->queryRange('SELECT * FROM {' . static::TABLE_NAME . '} q WHERE expire = 0 AND name = :name AND failures < :fail_limit ORDER BY created, item_id ASC', 0, $n, array(':name' => $this->name, ':fail_limit' => $this->max_fails))->fetchAllAssoc('item_id');
}
catch (\Exception $e) {
......@@ -347,7 +347,7 @@ class PushQueue extends DatabaseQueue {
if ($e instanceof EntityNotFoundException) {
// If there was an exception loading any entities, we assume that this queue item is no longer relevant.
\Drupal::logger('Salesforce Push')->error($e->getMessage() .
\Drupal::logger('Salesforce Push')->error($e->getMessage() .
' Exception while loading entity %type %id for salesforce mapping %mapping. Queue item deleted.',
[
'%type' => $mapping->get('drupal_entity_type'),
......@@ -417,7 +417,7 @@ class PushQueue extends DatabaseQueue {
}
catch (\Exception $e) {
$this->catchException($e);
}
}
}
}
......@@ -4,6 +4,7 @@ namespace Drupal\salesforce\Controller;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Drupal\salesforce\Rest\RestClient;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment