diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 40add26..f95c5c0 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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" @@ -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 diff --git a/composer.json b/composer.json index b58f83d..0fe0d24 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 57a0fe6..120182e 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -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) { @@ -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); @@ -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]); @@ -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()); @@ -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) { @@ -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]); @@ -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); @@ -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) { @@ -423,13 +421,13 @@ 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()); @@ -437,7 +435,7 @@ public function saveOutputConfigAction(Request $request, EventDispatcherInterfac $config = $newConfig; } - $configJson = $request->get('config'); + $configJson = $request->request->getString('config'); $config->setConfiguration($configJson); $event = new SaveConfigEvent($config); @@ -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) { diff --git a/src/Controller/ClassController.php b/src/Controller/ClassController.php index b72531a..8b98510 100644 --- a/src/Controller/ClassController.php +++ b/src/Controller/ClassController.php @@ -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); @@ -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);