-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52c50ba
commit ad26582
Showing
19 changed files
with
428 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
source/Internal/Framework/Controller/AbstractControllerDecorator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\Controller; | ||
|
||
abstract class AbstractControllerDecorator implements ControllerInterface | ||
{ | ||
public function __construct( | ||
protected readonly ControllerInterface $controller, | ||
) { | ||
} | ||
|
||
public function init() | ||
{ | ||
$this->controller->init(); | ||
} | ||
|
||
public function render() | ||
{ | ||
return $this->controller->render(); | ||
} | ||
|
||
public function getFncName() | ||
{ | ||
return $this->controller->getFncName(); | ||
} | ||
|
||
public function executeFunction($function) | ||
{ | ||
$this->controller->executeFunction($function); | ||
} | ||
|
||
public function getIsCallForCache() | ||
{ | ||
return $this->controller->getIsCallForCache(); | ||
} | ||
|
||
public function getClassKey() | ||
{ | ||
return $this->controller->getClassKey(); | ||
} | ||
|
||
public function getViewData() | ||
{ | ||
return $this->controller->getViewData(); | ||
} | ||
|
||
public function setViewData($viewData = null) | ||
{ | ||
$this->controller->setViewData($viewData); | ||
} | ||
|
||
public function getViewId() | ||
{ | ||
return $this->controller->getViewId(); | ||
} | ||
|
||
public function getCharSet() | ||
{ | ||
return $this->controller->getCharSet(); | ||
} | ||
|
||
public function setClassKey($classKey) | ||
{ | ||
$this->controller->setClassKey($classKey); | ||
} | ||
|
||
public function setFncName($fncName) | ||
{ | ||
$this->controller->setFncName($fncName); | ||
} | ||
|
||
public function setViewParameters($params = null) | ||
{ | ||
$this->controller->setViewParameters($params); | ||
} | ||
|
||
public function getViewParameter($key) | ||
{ | ||
return $this->controller->getViewParameter($key); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
source/Internal/Framework/Controller/ControllerInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\Controller; | ||
|
||
interface ControllerInterface | ||
{ | ||
public function init(); | ||
|
||
public function render(); | ||
|
||
public function executeFunction($function); | ||
|
||
public function setClassKey($classKey); | ||
|
||
public function getClassKey(); | ||
|
||
public function setFncName($fncName); | ||
|
||
public function getFncName(); | ||
|
||
public function setViewParameters($params = null); | ||
|
||
public function getViewParameter($key); | ||
|
||
public function setViewData($viewData = null); | ||
|
||
public function getViewData(); | ||
|
||
public function getViewId(); | ||
|
||
public function getCharSet(); | ||
|
||
public function getIsCallForCache(); | ||
} |
30 changes: 30 additions & 0 deletions
30
source/Internal/Framework/DIContainer/CompilerPass/ControllerPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Internal\Framework\DIContainer\CompilerPass; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class ControllerPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container): void | ||
{ | ||
$taggedServices = $container->findTaggedServiceIds('oxid.controller'); | ||
$controllersMap = []; | ||
|
||
foreach ($taggedServices as $id => $tags) { | ||
foreach ($tags as $attributes) { | ||
$controllersMap[$attributes['controller_key']] = $id; | ||
} | ||
} | ||
|
||
$container->setParameter('oxid.controllers_map', $controllersMap); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/Integration/Internal/Framework/Module/Controller/Fixtures/module1/composer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "oxid-esales/module1", | ||
"description": "", | ||
"type": "oxideshop-module", | ||
"license": [ | ||
"GPL-3.0" | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"OxidEsales\\Module1\\": "src/" | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/Integration/Internal/Framework/Module/Controller/Fixtures/module1/metadata.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller\ModuleController; | ||
use OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller\ModuleControllerMissingTemplate; | ||
|
||
$sMetadataVersion = '2.1'; | ||
|
||
$aModule = [ | ||
'id' => 'module1', | ||
'controllers' => [ | ||
'module1_controller' => ModuleController::class, | ||
], | ||
]; |
13 changes: 13 additions & 0 deletions
13
tests/Integration/Internal/Framework/Module/Controller/Fixtures/module1/services.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
|
||
OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller\ModuleControllerAsService: | ||
tags: | ||
- { name: 'oxid.controller', controller_key: 'test_module_controller_as_service' } | ||
public: true | ||
|
||
OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller\ModuleControllerDecorator: | ||
decorates: OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller\ModuleControllerAsService | ||
arguments: [ '@.inner' ] | ||
public: true |
17 changes: 17 additions & 0 deletions
17
...Internal/Framework/Module/Controller/Fixtures/module1/src/Controller/ModuleController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller; | ||
|
||
use OxidEsales\Eshop\Application\Controller\FrontendController; | ||
|
||
class ModuleController extends FrontendController | ||
{ | ||
protected $_sThisTemplate = '@module1/module_controller'; | ||
} |
22 changes: 22 additions & 0 deletions
22
...Framework/Module/Controller/Fixtures/module1/src/Controller/ModuleControllerAsService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Controller\Fixtures\module1\src\Controller; | ||
|
||
use OxidEsales\EshopCommunity\Core\Controller\BaseController; | ||
|
||
class ModuleControllerAsService extends BaseController | ||
{ | ||
protected $_sThisTemplate = '@module1/module_controller_as_service'; | ||
|
||
public function testFunction(): void | ||
{ | ||
echo 'Function output'; | ||
} | ||
} |
Oops, something went wrong.