Skip to content

Commit

Permalink
Removed some deprecated features
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Oct 13, 2018
1 parent 45ae881 commit 3bc5233
Show file tree
Hide file tree
Showing 25 changed files with 1 addition and 1,134 deletions.
7 changes: 0 additions & 7 deletions src/Configuration/TemplateConfigPass.php
Expand Up @@ -123,13 +123,6 @@ private function processEntityTemplates(array $backendConfig)
if (isset($fieldMetadata['template'])) {
$templatePath = $fieldMetadata['template'];

// template path should contain the .html.twig extension
// however, for usability reasons, we silently fix this issue if needed
if ('.html.twig' !== mb_substr($templatePath, -10)) {
$templatePath .= '.html.twig';
@trigger_error(sprintf('Passing a template path without the ".html.twig" extension is deprecated since version 1.11.7 and will be removed in 2.0. Use "%s" as the value of the "template" option for the "%s" field in the "%s" view of the "%s" entity.', $templatePath, $fieldName, $view, $entityName), E_USER_DEPRECATED);
}

// before considering $templatePath a regular Symfony template
// path, check if the given template exists in any of these directories:
// * app/Resources/views/easy_admin/<entityName>/<templatePath>
Expand Down
15 changes: 0 additions & 15 deletions src/Controller/AdminController.php
Expand Up @@ -686,21 +686,6 @@ protected function isActionAllowed($actionName)
return false === \in_array($actionName, $this->entity['disabled_actions'], true);
}

/**
* Utility shortcut to render an error when the requested action is not allowed
* for the given entity.
*
* @param string $action
*
* @deprecated Use the ForbiddenException instead of this method
*
* @return Response
*/
protected function renderForbiddenActionError($action)
{
return $this->render('@EasyAdmin/error/forbidden_action.html.twig', ['action' => $action], new Response('', 403));
}

/**
* Given a method name pattern, it looks for the customized version of that
* method (based on the entity name) and executes it. If the custom method
Expand Down
3 changes: 1 addition & 2 deletions src/DataCollector/EasyAdminDataCollector.php
Expand Up @@ -45,8 +45,7 @@ public function reset()
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
// 'admin' is the deprecated route name that will be removed in version 2.0.
if (!\in_array($request->attributes->get('_route'), ['easyadmin', 'admin'])) {
if ('easyadmin' !== $request->attributes->get('_route')) {
return;
}

Expand Down
129 changes: 0 additions & 129 deletions src/DependencyInjection/Configuration.php
Expand Up @@ -18,7 +18,6 @@ public function getConfigTreeBuilder()
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('easy_admin');

$this->addDeprecationsSection($rootNode);
$this->addGlobalOptionsSection($rootNode);
$this->addDesignSection($rootNode);
$this->addViewsSection($rootNode);
Expand All @@ -27,134 +26,6 @@ public function getConfigTreeBuilder()
return $treeBuilder;
}

private function addDeprecationsSection(ArrayNodeDefinition $rootNode)
{
$rootNode
// 'list_max_results' global option was deprecated in 1.0.8
// and replaced by 'list -> max_results'
->beforeNormalization()
->ifTrue(function ($v) {
return isset($v['list_max_results']);
})
->then(function ($v) {
if (!isset($v['list'])) {
$v['list'] = [];
}

// if the new option is defined, don't override it with the legacy option
if (!isset($v['list']['max_results'])) {
$v['list']['max_results'] = $v['list_max_results'];
}

unset($v['list_max_results']);

return $v;
})
->end()

// 'list_actions' global option was deprecated in 1.0.8
// and replaced by 'list -> actions'
->beforeNormalization()
->ifTrue(function ($v) {
return isset($v['list_actions']);
})
->then(function ($v) {
// if the new option is defined, don't override it with the legacy option
if (!isset($v['list']['actions'])) {
$v['list']['actions'] = $v['list_actions'];
}

unset($v['list_actions']);

return $v;
})
->end()

// make sure the new 'design' global option exists to simplify
// updating the deprecated 'assets -> css' and 'assets -> js' options
->beforeNormalization()
->always()
->then(function ($v) {
if (!isset($v['design'])) {
$v['design'] = ['assets' => []];
}

return $v;
})
->end()

// 'assets -> css' global option was deprecated in 1.1.0
// and replaced by 'design -> assets -> css'
->beforeNormalization()
->ifTrue(function ($v) {
return isset($v['assets']['css']);
})
->then(function ($v) {
// if the new option is defined, don't override it with the legacy option
if (!isset($v['design']['assets']['css'])) {
$v['design']['assets']['css'] = $v['assets']['css'];
}

unset($v['assets']['css']);

return $v;
})
->end()

// 'assets -> js' global option was deprecated in 1.1.0
// and replaced by 'design -> assets -> js'
->beforeNormalization()
->ifTrue(function ($v) {
return isset($v['assets']['js']);
})
->then(function ($v) {
// if the new option is defined, don't override it with the legacy option
if (!isset($v['design']['assets']['js'])) {
$v['design']['assets']['js'] = $v['assets']['js'];
}

unset($v['assets']['js']);

return $v;
})
->end()

// after updating 'assets -> css' and 'assets -> js' deprecated options,
// remove the parent 'assets' deprecated option if it's defined
->beforeNormalization()
->always()
->then(function ($v) {
if (isset($v['assets'])) {
unset($v['assets']);
}

return $v;
})
->end()

->children()
->variableNode('list_actions')
->info('DEPRECATED: use the "actions" option of the "list" view.')
->end()

->integerNode('list_max_results')
->info('DEPRECATED: use "max_results" option under the "list" global key.')
->end()

->arrayNode('assets')
->children()
->arrayNode('css')
->info('DEPRECATED: use the "design -> assets -> css" option.')
->end()
->arrayNode('js')
->info('DEPRECATED: use the "design -> assets -> js" option.')
->end()
->end()
->end()
->end()
;
}

private function addGlobalOptionsSection(ArrayNodeDefinition $rootNode)
{
$rootNode
Expand Down
2 changes: 0 additions & 2 deletions tests/Configuration/ConfigManagerTest.php
Expand Up @@ -49,12 +49,10 @@ public function provideConfigFilePaths()
{
$inputs = array_merge(
glob(__DIR__.'/fixtures/configurations/input/admin_*.yml'),
glob(__DIR__.'/fixtures/deprecations/input/admin_*.yml'),
glob(__DIR__.'/fixtures/templates/*/input/admin_*.yml')
);
$outputs = array_merge(
glob(__DIR__.'/fixtures/configurations/output/config_*.yml'),
glob(__DIR__.'/fixtures/deprecations/output/config_*.yml'),
glob(__DIR__.'/fixtures/templates/*/output/config_*.yml')
);

Expand Down
7 changes: 0 additions & 7 deletions tests/Configuration/fixtures/deprecations/input/admin_003.yml

This file was deleted.

7 changes: 0 additions & 7 deletions tests/Configuration/fixtures/deprecations/input/admin_004.yml

This file was deleted.

11 changes: 0 additions & 11 deletions tests/Configuration/fixtures/deprecations/input/admin_005.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tests/Configuration/fixtures/deprecations/input/admin_006.yml

This file was deleted.

15 changes: 0 additions & 15 deletions tests/Configuration/fixtures/deprecations/input/admin_007.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tests/Configuration/fixtures/deprecations/input/admin_008.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tests/Configuration/fixtures/deprecations/input/admin_009.yml

This file was deleted.

17 changes: 0 additions & 17 deletions tests/Configuration/fixtures/deprecations/input/admin_010.yml

This file was deleted.

19 changes: 0 additions & 19 deletions tests/Configuration/fixtures/deprecations/input/admin_011.yml

This file was deleted.

19 changes: 0 additions & 19 deletions tests/Configuration/fixtures/deprecations/input/admin_012.yml

This file was deleted.

0 comments on commit 3bc5233

Please sign in to comment.