Skip to content

Commit

Permalink
Merge branch 'pimcore:5.x' into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
aweichler authored Oct 16, 2024
2 parents 9294c62 + 868867c commit bc12687
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- { php-version: "8.2", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", phpstan_args: "", experimental: true }
steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:

- name: "Upload baseline file"
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: phpstan-baseline.neon
path: phpstan-baseline.neon
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"license": "GPL-3.0+",
"type": "pimcore-bundle",
"require": {
"pimcore/pimcore": "^11.0",
"pimcore/pimcore": "^11.2",
"symfony/config": "^6.2",
"symfony/dependency-injection": "^6.2",
"symfony/event-dispatcher": "^6.2",
"symfony/event-dispatcher-contracts": "^3.0",
"symfony/http-foundation": "^6.2",
"symfony/http-foundation": "^6.3",
"symfony/http-kernel": "^6.2",
"symfony/routing": "^6.2",
"symfony/templating": "^6.2"
Expand Down
46 changes: 22 additions & 24 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function getSubscribedServices(): array
*/
public function initializeAction(Request $request, EventDispatcherInterface $eventDispatcher)
{
$objectId = $request->get('id');
$objectId = $request->query->getInt('id');
$object = AbstractObject::getById($objectId);

if (!$object) {
Expand Down Expand Up @@ -104,7 +104,7 @@ public function getOutputConfigsAction(Request $request)
Service::initChannelsForRootobject();
$channels = Service::getChannels();

$objectId = $request->get('object_id');
$objectId = $request->request->getInt('object_id');
$object = AbstractObject::getById($objectId);

$classList = $this->getFilteredClassDefinitionList($request);
Expand Down Expand Up @@ -166,7 +166,7 @@ private function getOutputDefinitionForObjectAndChannel($object, $classId, $chan
public function resetOutputConfigAction(Request $request)
{
try {
$config = OutputDefinition::getById($request->get('config_id'));
$config = OutputDefinition::getById($request->query->getInt('config_id'));
$config->delete();

return $this->jsonResponse(['success' => true]);
Expand All @@ -187,7 +187,7 @@ public function resetOutputConfigAction(Request $request)
public function getOutputConfigAction(Request $request)
{
try {
$config = OutputDefinition::getById($request->get('config_id'));
$config = OutputDefinition::getById($request->query->getInt('config_id'));

$objectClass = ClassDefinition::getById($config->getClassId());
$configuration = json_decode($config->getConfiguration());
Expand All @@ -213,19 +213,17 @@ public function getOutputConfigAction(Request $request)
public function getOrCreateOutputConfigAction(Request $request)
{
try {
$config = OutputDefinition::getById($request->get('config_id'));
$config = OutputDefinition::getById($request->query->getInt('config_id'));
$class = null;
if (!$config) {
if (is_numeric($request->get('class_id'))) {
$class = ClassDefinition::getById($request->get('class_id'));
} else {
$class = ClassDefinition::getByName($request->get('class_id'));
if ($request->query->has('class_id')) {
$class = ClassDefinition::getByName($request->query->getString('class_id'));
}
if (!$class) {
throw new \Exception('Class ' . $request->get('class_id') . ' not found.');
throw new \Exception('Class ' . $request->query->getString('class_id') . ' not found.');
}

$config = OutputDefinition::getByObjectIdClassIdChannel($request->get('objectId'), $class->getId(), $request->get('channel'));
$config = OutputDefinition::getByObjectIdClassIdChannel($request->query->getInt('objectId'), $class->getId(), $request->query->getString('channel'));
}

if ($config) {
Expand All @@ -237,9 +235,9 @@ public function getOrCreateOutputConfigAction(Request $request)
return $this->jsonResponse(['success' => true, 'outputConfig' => $config]);
} else {
$config = new OutputDefinition();
$config->setChannel($request->get('channel'));
$config->setChannel($request->query->getString('channel'));
$config->setClassId($class->getId());
$config->setObjectId($request->get('objectId'));
$config->setObjectId($request->query->getInt('objectId'));
$config->save();

return $this->jsonResponse(['success' => true, 'outputConfig' => $config]);
Expand Down Expand Up @@ -314,8 +312,8 @@ private function sortAttributes(array &$attributes)
*/
public function getAttributeLabelsAction(Request $request)
{
$configration = json_decode($request->get('configuration'));
$class = ClassDefinition::getById($request->get('classId'));
$configration = json_decode($request->request->getString('configuration'));
$class = ClassDefinition::getById($request->request->getString('classId'));

$configration = $this->doGetAttributeLabels($configration, $class);

Expand Down Expand Up @@ -403,8 +401,8 @@ private function getFieldDefinition($attributeName, $objectClass)
public function getFieldDefinitionAction(Request $request)
{
try {
$objectClass = ClassDefinition::getById($request->get('class_id'));
$def = $this->getFieldDefinition($request->get('key'), $objectClass);
$objectClass = ClassDefinition::getById($request->query->getString('class_id'));
$def = $this->getFieldDefinition($request->query->getString('key'), $objectClass);

return $this->jsonResponse(['success' => true, 'fieldDefinition' => $def]);
} catch (\Exception $e) {
Expand All @@ -423,21 +421,21 @@ public function getFieldDefinitionAction(Request $request)
public function saveOutputConfigAction(Request $request, EventDispatcherInterface $eventDispatcher)
{
try {
$config = OutputDefinition::getById($request->get('config_id'));
$config = OutputDefinition::getById($request->request->getInt('config_id'));

$object = AbstractObject::getById($request->get('object_id'));
$object = AbstractObject::getById($request->request->getInt('object_id'));
if (empty($object)) {
throw new \Exception('Data Object with ID' . $request->get('object_id') . ' not found.');
throw new \Exception('Data Object with ID' . $request->request->getInt('object_id') . ' not found.');
}
if ($config->getObjectId() != $request->get('object_id')) {
if ($config->getObjectId() != $request->request->getInt('object_id')) {
$newConfig = new OutputDefinition();
$newConfig->setChannel($config->getChannel());
$newConfig->setClassId($config->getClassId());
$newConfig->setObjectId($object->getId());
$config = $newConfig;
}

$configJson = $request->get('config');
$configJson = $request->request->getString('config');
$config->setConfiguration($configJson);

$event = new SaveConfigEvent($config);
Expand Down Expand Up @@ -469,8 +467,8 @@ private function getFilteredClassDefinitionList(Request $request): ClassDefiniti
{
$classList = new ClassDefinition\Listing();

if ($request->get('class_id')) {
$classList->setCondition('id = ?', $request->get('class_id'));
if ($request->request->has('class_id')) {
$classList->setCondition('id = ?', $request->request->getString('class_id'));
} elseif (!empty($this->defaultGridClasses)) {
$allowedClassIds = [];
foreach ($this->defaultGridClasses as $allowedClass) {
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/ClassController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class ClassController extends UserAwareController
*/
public function getClassDefinitionForColumnConfigAction(Request $request, EventDispatcherInterface $eventDispatcher, FactoryInterface $factory)
{
$classId = $request->get('id');
$classId = $request->query->getString('id');
$class = DataObject\ClassDefinition::getById($classId);
$objectId = intval($request->get('oid'));
$objectId = $request->query->getInt('oid');

$filteredDefinitions = DataObject\Service::getCustomLayoutDefinitionForGridColumnConfig($class, $objectId);

Expand Down Expand Up @@ -131,7 +131,7 @@ private function considerClassificationStoreForColumnConfig(Request $request, ?D
$enrichment = false;
$grouped = $this->getClassificationGroupedDisplay();
if ($displayMode == ColumnConfigDisplayMode::DATA_OBJECT || $displayMode == ColumnConfigDisplayMode::RELEVANT) {
$targetObjectId = $request->get('target_oid');
$targetObjectId = $request->query->getInt('target_oid');

if ($targetObject = DataObject\Concrete::getById($targetObjectId)) {
$class->setFieldDefinitions($fieldDefinitions);
Expand Down

0 comments on commit bc12687

Please sign in to comment.