-
Notifications
You must be signed in to change notification settings - Fork 21
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
Showing
11 changed files
with
110 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/** | ||
* This file is part of contao-community-alliance/dc-general. | ||
* | ||
* (c) 2013-2023 Contao Community Alliance. | ||
* (c) 2013-2024 Contao Community Alliance. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -15,7 +15,7 @@ | |
* @author Sven Baumann <[email protected]> | ||
* @author David Molineus <[email protected]> | ||
* @author Ingolf Steinhardt <[email protected]> | ||
* @copyright 2013-2023 Contao Community Alliance. | ||
* @copyright 2013-2024 Contao Community Alliance. | ||
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later | ||
* @filesource | ||
*/ | ||
|
@@ -144,7 +144,7 @@ protected function process(EnvironmentInterface $environment) | |
return null; | ||
} | ||
|
||
ViewHelpers::redirectHome($environment); | ||
ViewHelpers::redirectCleanHome($environment, ['source', 'after', 'into']); | ||
|
||
return null; | ||
} | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/** | ||
* This file is part of contao-community-alliance/dc-general. | ||
* | ||
* (c) 2013-2023 Contao Community Alliance. | ||
* (c) 2013-2024 Contao Community Alliance. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -16,7 +16,7 @@ | |
* @author Ingolf Steinhardt <[email protected]> | ||
* @author David Molineus <[email protected]> | ||
* @author Stefan Heimes <[email protected]> | ||
* @copyright 2013-2023 Contao Community Alliance. | ||
* @copyright 2013-2024 Contao Community Alliance. | ||
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later | ||
* @filesource | ||
*/ | ||
|
@@ -160,6 +160,8 @@ public function __construct(EnvironmentInterface $environment) | |
* | ||
* @return ModelInterface|null | ||
* | ||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) | ||
* | ||
* @throws \InvalidArgumentException When the model id is invalid. | ||
*/ | ||
public function getModel($modelId, $providerName = null) | ||
|
@@ -185,34 +187,34 @@ public function getModel($modelId, $providerName = null) | |
assert($dataProvider instanceof DataProviderInterface); | ||
|
||
$config = $dataProvider->getEmptyConfig(); | ||
$config->setId($modelId->getId()); | ||
|
||
if ($definition->getName() === $modelId->getDataProviderName()) { | ||
$propertyDefinition = $definition->getPropertiesDefinition(); | ||
} elseif ($parentDefinition && $parentDefinition->getName() === $modelId->getDataProviderName()) { | ||
$propertyDefinition = $parentDefinition->getPropertiesDefinition(); | ||
} else { | ||
throw new \InvalidArgumentException('Invalid provider name ' . $modelId->getDataProviderName()); | ||
$propertyDefinition = null; | ||
} | ||
if (null !== $propertyDefinition) { | ||
$properties = []; | ||
// Filter real properties from the property definition. | ||
foreach ($propertyDefinition->getPropertyNames() as $propertyName) { | ||
if ($dataProvider->fieldExists($propertyName)) { | ||
$properties[] = $propertyName; | ||
continue; | ||
} | ||
|
||
$properties = []; | ||
|
||
// Filter real properties from the property definition. | ||
foreach ($propertyDefinition->getPropertyNames() as $propertyName) { | ||
if ($dataProvider->fieldExists($propertyName)) { | ||
$properties[] = $propertyName; | ||
|
||
continue; | ||
// @codingStandardsIgnoreStart | ||
@\trigger_error( | ||
'Only real property is allowed in the property definition.' . | ||
'This will no longer be supported in the future.', | ||
E_USER_DEPRECATED | ||
); | ||
// @codingStandardsIgnoreEnd | ||
} | ||
|
||
// @codingStandardsIgnoreStart | ||
@\trigger_error( | ||
'Only real property is allowed in the property definition.' . | ||
'This will no longer be supported in the future.', | ||
E_USER_DEPRECATED | ||
); | ||
// @codingStandardsIgnoreEnd | ||
$config->setFields($properties); | ||
} | ||
$config->setId($modelId->getId())->setFields($properties); | ||
|
||
return $dataProvider->fetch($config); | ||
} | ||
|