Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/ClassificationStore/Controller/GetLayoutByKeyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ public function __construct(
* @throws NotFoundException
*/
#[Route(
path: '/classification-store/layout-by-key/{keyId}',
path: '/classification-store/layout-by-key/{keyId}/{groupId}',
name: 'pimcore_studio_api_classification_store_get_layout_by_key',
methods: ['GET']
)]
#[IsGranted(UserPermissions::DATA_OBJECTS->value)]
#[Get(
path: self::PREFIX . '/classification-store/layout-by-key/{keyId}',
path: self::PREFIX . '/classification-store/layout-by-key/{keyId}/{groupId}',
operationId: 'classification_store_get_layout_by_key',
description: 'classification_store_get_layout_by_key_description',
summary: 'classification_store_get_layout_by_key_summary',
Expand All @@ -80,6 +80,10 @@ public function __construct(
type: 'Key ID',
name: 'keyId',
)]
#[PathIdParameter(
type: 'Group ID',
name: 'groupId',
)]
#[TextFieldParameter(
name: 'fieldName',
description: 'Field Name',
Expand All @@ -94,9 +98,10 @@ public function __construct(
public function getLayoutByKey(
#[MapQueryString] LayoutParameter $layoutParameter,
int $keyId,
int $groupId
): JsonResponse {
return $this->jsonResponse(
$this->keyGroupLayoutService->getKeyLayout($layoutParameter, $keyId)
$this->keyGroupLayoutService->getKeyLayout($layoutParameter, $keyId, $groupId)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ public function getByGroupId(int $groupId): array
/**
* @inheritDoc
*/
public function getByKeyId(int $keyId): KeyGroupRelation
public function getByKeyGroupId(int $keyId, int $groupId): KeyGroupRelation
{
$listing = new Listing();
$listing->setOrder('ASC');
$listing->setCondition('id = ?', $keyId);
$listing->addConditionParam('keyId = ?', $keyId);
$listing->addConditionParam('groupId = ?', $groupId);

$list = $listing->load();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ public function getByGroupId(int $groupId): array;
/**
* @throws NotFoundException
*/
public function getByKeyId(int $keyId): KeyGroupRelation;
public function getByKeyGroupId(int $keyId, int $groupId): KeyGroupRelation;
}
5 changes: 3 additions & 2 deletions src/ClassificationStore/Service/KeyGroupLayoutService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public function getLayoutDefinition(
*/
public function getKeyLayout(
LayoutParameter $layoutParameter,
int $keyId
int $keyId,
int $groupId
): KeyLayout {

$object = null;
Expand All @@ -88,7 +89,7 @@ public function getKeyLayout(
}
}

$key = $this->keyGroupRelationRepository->getByKeyId($keyId);
$key = $this->keyGroupRelationRepository->getByKeyGroupId($keyId, $groupId);
$definition = $this->getLayoutDefinition($key, $layoutParameter->getFieldName(), $object);

return new KeyLayout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ public function getLayoutDefinition(
public function getKeyLayout(
LayoutParameter $layoutParameter,
int $keyId,
int $groupId
): KeyLayout;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());

$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());

if (!is_array($filterValue->getValue())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

foreach ($parameters->getColumnFilterByType(ColumnType::CLASSIFICATION_STORE_DATE->value) as $column) {
$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());
$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());
/** @var DataObjectQueryInterface $query */
$query = $this->applyClassificationStoreDateFilter($column, $query, $key, $group, $filterValue, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

foreach ($parameters->getColumnFilterByType(ColumnType::CLASSIFICATION_STORE_DATETIME->value) as $column) {
$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());
$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());
/** @var DataObjectQueryInterface $query */
$query = $this->applyClassificationStoreDateFilter($column, $query, $key, $group, $filterValue, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());

$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());
$value = $filterValue->getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface
$this->addFilterToQuery(
$query,
$column,
$this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId()),
$this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
),
$this->groupConfigRepository->getById($filterValue->getGroupId()),
$mode,
$isValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());

$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());
$value = $filterValue->getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());

$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());
$value = $filterValue->getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());

$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());

if (!is_array($filterValue->getValue())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());

$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());

if (!is_string($filterValue->getValue())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public function apply(mixed $parameters, QueryInterface $query): QueryInterface

foreach ($parameters->getColumnFilterByType(ColumnType::CLASSIFICATION_STORE_TIME->value) as $column) {
$filterValue = $this->getClassificationStoreFilterValue($column->getFilterValue());
$key = $this->keyGroupRelationRepository->getByKeyId($filterValue->getKeyId());
$key = $this->keyGroupRelationRepository->getByKeyGroupId(
$filterValue->getKeyId(),
$filterValue->getGroupId()
);
$group = $this->groupConfigRepository->getById($filterValue->getGroupId());
/** @var DataObjectQueryInterface $query */
$query = $this->applyTimeFilter($column, $query, $key, $group, $filterValue);
Expand Down