Skip to content

Commit

Permalink
Fix for $app_warnings_checker is deprecation message (#1006)
Browse files Browse the repository at this point in the history
* Removed deprecation message as variable already defined

* Changes to avoid errors

* fixing phpcs error

* Changes removed as the testcases are failing due to new parameter added.

* Changes removed for edgeentitylist builder

* Changes updated with service

* Changes to add required parameters while calling construct

* Removal of unnecessary code
  • Loading branch information
kedarkhaire authored Jan 3, 2024
1 parent 0f30120 commit b7313f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace Drupal\apigee_edge_teams\Entity\ListBuilder;

use Drupal\apigee_edge\Entity\AppWarningsCheckerInterface;
use Drupal\apigee_edge\Entity\ListBuilder\AppListBuilder;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
Expand Down Expand Up @@ -62,13 +63,15 @@ class TeamAppListByTeam extends AppListBuilder implements ContainerInjectionInte
* The route match object.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\apigee_edge\Entity\AppWarningsCheckerInterface $app_warnings_checker
* The app warnings checker service.
*/
public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory = NULL) {
public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker) {
if (!$config_factory) {
$config_factory = \Drupal::service('config.factory');
}

parent::__construct($entity_type, $entity_type_manager, $render, $request_stack, $time, $config_factory);
parent::__construct($entity_type, $entity_type_manager, $render, $request_stack, $time, $config_factory, $app_warnings_checker);
$this->routeMatch = $route_match;
}

Expand All @@ -83,7 +86,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
$container->get('request_stack'),
$container->get('datetime.time'),
$container->get('current_route_match'),
$container->get('config.factory')
$container->get('config.factory'),
$container->get('apigee_edge.entity.app_warnings_checker')
);
}

Expand Down
9 changes: 3 additions & 6 deletions src/Entity/ListBuilder/AppListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,10 @@ class AppListBuilder extends EdgeEntityListBuilder {
* @param \Drupal\apigee_edge\Entity\AppWarningsCheckerInterface $app_warnings_checker
* The app warnings checker service.
*/
public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, RequestStack $request_stack, TimeInterface $time, ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker = NULL) {
public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, RequestStack $request_stack, TimeInterface $time, ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker) {
if (!$config_factory) {
$config_factory = \Drupal::service('config.factory');
}
if (!$app_warnings_checker) {
@trigger_error('Calling ' . __METHOD__ . ' without the $app_warnings_checker is deprecated in apigee_edge:8-x-1.18 and is required before apigee_edge:8.x-2.0. See https://github.com/apigee/apigee-edge-drupal/pull/507', E_USER_DEPRECATED);
$app_warnings_checker = \Drupal::service('apigee_edge.entity.app_warnings_checker');
}

parent::__construct($entity_type, $entity_type_manager, $config_factory);
$this->renderer = $renderer;
Expand All @@ -121,7 +117,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
$container->get('renderer'),
$container->get('request_stack'),
$container->get('datetime.time'),
$container->get('config.factory')
$container->get('config.factory'),
$container->get('apigee_edge.entity.app_warnings_checker')
);
}

Expand Down
10 changes: 7 additions & 3 deletions src/Entity/ListBuilder/DeveloperAppListBuilderForDeveloper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace Drupal\apigee_edge\Entity\ListBuilder;

use Drupal\apigee_edge\Entity\AppInterface;
use Drupal\apigee_edge\Entity\AppWarningsCheckerInterface;
use Drupal\apigee_edge\Exception\DeveloperDoesNotExistException;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Component\Utility\Html;
Expand Down Expand Up @@ -85,13 +86,15 @@ class DeveloperAppListBuilderForDeveloper extends AppListBuilder implements Cont
* The route match object.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\apigee_edge\Entity\AppWarningsCheckerInterface $app_warnings_checker
* The app warnings checker service.
*/
public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, AccountInterface $current_user, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory = NULL) {
public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, RendererInterface $render, RequestStack $request_stack, TimeInterface $time, AccountInterface $current_user, RouteMatchInterface $route_match, ConfigFactoryInterface $config_factory = NULL, AppWarningsCheckerInterface $app_warnings_checker) {
if (!$config_factory) {
$config_factory = \Drupal::service('config.factory');
}

parent::__construct($entity_type, $entity_type_manager, $render, $request_stack, $time, $config_factory);
parent::__construct($entity_type, $entity_type_manager, $render, $request_stack, $time, $config_factory, $app_warnings_checker);
$this->currentUser = $current_user;
$this->routeMatch = $route_match;
}
Expand All @@ -108,7 +111,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
$container->get('datetime.time'),
$container->get('current_user'),
$container->get('current_route_match'),
$container->get('config.factory')
$container->get('config.factory'),
$container->get('apigee_edge.entity.app_warnings_checker')
);
}

Expand Down

0 comments on commit b7313f7

Please sign in to comment.