Skip to content

Commit

Permalink
Update request body structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed May 7, 2024
1 parent 9e7f1eb commit 7721164
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Content;
namespace Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Content;

use OpenApi\Attributes\Items;
use OpenApi\Attributes\JsonContent;
Expand Down
8 changes: 2 additions & 6 deletions src/OpenApi/Attributes/Request/ElementPropertyRequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
namespace Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Request;

use Attribute;
use OpenApi\Attributes\Items;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\RequestBody;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\Property\Schema\UpdateElementProperty;

#[Attribute(Attribute::TARGET_METHOD)]
Expand All @@ -29,10 +28,7 @@ public function __construct()
{
parent::__construct(
required: true,
content: new JsonContent(
type: 'array',
items: new Items(ref: UpdateElementProperty::class)
)
content: new ItemsJson(UpdateElementProperty::class)
);
}
}
2 changes: 1 addition & 1 deletion src/Property/Controller/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
use OpenApi\Attributes\Get;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\Exception\InvalidQueryTypeException;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Parameters\Query\ElementTypeParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Parameters\Query\FilterParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\BadRequestResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\MethodNotAllowedResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnauthorizedResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Property/Controller/Element/GetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

use OpenApi\Attributes\Get;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Parameters\Path\ElementTypeParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Parameters\Path\IdParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\MethodNotAllowedResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\NotFoundResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnauthorizedResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Property/Controller/Element/PutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

use OpenApi\Attributes\Put;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Parameters\Path\ElementTypeParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Parameters\Path\IdParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Request\ElementPropertyRequestBody;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Content\ItemsJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\MethodNotAllowedResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\NotFoundResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnauthorizedResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Property/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function updatePredefinedProperty(string $id, UpdatePredefinedProperty $p
$predefined->setData($property->getData());
$predefined->setConfig($property->getConfig());
$predefined->setCtype($property->getCtype());
$predefined->setInheritable($property->getInheritable());
$predefined->setInheritable($property->isInheritable());

$predefined->save();

Expand Down
2 changes: 1 addition & 1 deletion src/Property/Service/PropertyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function updateElementProperties(string $elementType, int $id, UpdateElem
$property->setName($updateProperty->getKey());
$property->setData($updateProperty->getData());
$property->setInheritable($updateProperty->getInheritable());
$properties[] = $property;
$properties[$updateProperty->getKey()] = $property;
}
$element->setProperties($properties);
$element->save();

Check notice on line 62 in src/Property/Service/PropertyService.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Unhandled exception

Unhandled exceptions

Check notice on line 62 in src/Property/Service/PropertyService.php

View workflow job for this annotation

GitHub Actions / Qodana for PHP

Unhandled exception

Unhandled exceptions
Expand Down

0 comments on commit 7721164

Please sign in to comment.