Skip to content

Commit

Permalink
[Update] Unlock EstateManagerController support for Symfony ^5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
zoglo committed Oct 25, 2022
1 parent ade873f commit 91b6054
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
}
],
"require":{
"php":">=7.2",
"php": "^7.4 || ^8.0",
"ext-json": "*",
"contao/core-bundle":"^4.4"
"contao/core-bundle":"^4.9"
},
"require-dev": {
"contao/manager-plugin": "^2.0",
Expand Down
17 changes: 14 additions & 3 deletions src/Controller/EstateManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,36 @@

namespace ContaoEstateManager\EstateManager\Controller;

use Contao\CoreBundle\Framework\ContaoFramework;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
use ContaoEstateManager\EstateManagerRead;

/**
* Handles the EstateManager api routes.
*
* @Route(defaults={"_scope" = "frontend"})
*
* @author Daniele Sciannimanica <https://github.com/doishub>
*/
class EstateManagerController extends AbstractController
{
private ContaoFramework $framework;

public function __construct(ContaoFramework $framework)
{
$this->framework = $framework;
}

/**
* Runs the command scheduler. (READ)
*
* @return JsonResponse
* @Route("/api/estatemanager/v{version}/{module}/{id}", name="glossary_item_json", defaults={"id" = null})
*/
public function readAction($version, $module, $id)
public function readAction(int $version, string $module, $id): JsonResponse
{
$this->container->get('contao.framework')->initialize();
$this->framework->initialize();

$controller = new EstateManagerRead();

Expand Down
11 changes: 2 additions & 9 deletions src/Resources/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
estatemanager_api_read:
path: /api/estatemanager/v{version}/{module}/{id}
defaults:
_controller: "EstateManager:EstateManager:read"
_scope: frontend
_token_check: false
id: null
requirements:
version: '\d+'
methods: [GET]
resource: '@EstateManager/Controller'
type: annotation
9 changes: 9 additions & 0 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: true

ContaoEstateManager\EstateManager\:
resource: '../../'
exclude: '../../{Model,DependencyInjection,Resources}'

0 comments on commit 91b6054

Please sign in to comment.