Skip to content

Commit

Permalink
WIP Attempting to fix dependency injection abject failure awaits
Browse files Browse the repository at this point in the history
  • Loading branch information
stesi561 committed Jun 2, 2023
1 parent f8e86dd commit 66a5738
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
7 changes: 4 additions & 3 deletions civicrm_entity.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ services:
tags:
- { name: service_collector, tag: 'module_install.uninstall_validator', call: addUninstallValidator }


civicrm_entity.contact_checksum_access_checker:
class: Drupal\civicrm_entity\Access\ContactChecksumCheckAccess
arguments: ['@request_stack', '@civicrm_entity.api']
autowire: true
tags:
- {name: access_check, applies_to: _civicrm_entity_checksum_access_check }

civicrm_entity.views_access_contactchecksum:
class: Drupal\civicrm_entity\Plugin\views\Access\ContactChecksum
arguments: ['@request_stack', '@civicrm_entity.api']
class: Drupal\civicrm_entity\Plugin\views\access\ContactChecksum
autowire: true
9 changes: 5 additions & 4 deletions src/Access/ContactChecksumCheckAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Logger\LoggerChannelTrait;
use Drupal\civicrm_entity\CiviCrmApiInterface;

use Symfony\Component\HttpFoundation\RequestStack;

use Symfony\Component\Routing\Route;


Expand All @@ -30,14 +32,13 @@ class ContactChecksumCheckAccess implements AccessInterface {
/**
* Constructs a ContactChecksumCheckAccess object.
*
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack.
* @param \Drupal\civicrm_entity\CiviCrmApiInterface $civicrm_api
* The CiviCRM API bridge.
*/
public function __construct(RequestStack $requestStack, CiviCrmApiInterface $civicrm_api) {
$this->namespaces = QueryBase::getNamespaces($this);
$this->requestStack = $requestStack;
public function __construct(RequestStack $request_stack, CiviCrmApiInterface $civicrm_api) {
$this->requestStack = $request_stack;
$this->civicrmApi = $civicrm_api;
}

Expand Down
11 changes: 8 additions & 3 deletions src/Plugin/views/access/ContactChecksum.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\user\RoleStorageInterface;

use Drupal\civicrm_entity\CiviCrmApiInterface;

use Symfony\Component\Routing\Route;

use Drupal\user\Plugin\views\access\Role;
use Symfony\Component\HttpFoundation\RequestStack;



use \Civi\Api4\Contact;

/**
Expand Down Expand Up @@ -43,13 +47,14 @@ class ContactChecksum extends Role implements CacheableDependencyInterface {

/**
* Constructs a ContactChecksum object.
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
*
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack.
* @param \Drupal\civicrm_entity\CiviCrmApiInterface $civicrm_api
* The CiviCRM API bridge.
*/
public function __construct(RequestStack $requestStack, CiviCrmApiInterface $civicrm_api) {
$this->requestStack = $requestStack;
public function __construct(RequestStack $request_stack, CiviCrmApiInterface $civicrm_api) {
$this->requestStack = $request_stack;
$this->civicrmApi = $civicrm_api;
}

Expand Down

0 comments on commit 66a5738

Please sign in to comment.