public function checkFieldKey(ServerRequest $request, Response $response): Response
    {
        $queryParams = $request->getQueryParams();
        $fieldKey = $queryParams['key'];
        $table = 'tt_content';
        if (isset($queryParams['table'])) {
            $table = $queryParams['table'];
        }

        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
        $storageRepository = $objectManager->get(StorageRepository::class);

        // check if fieldKey is available for this table
        $isAvailable = true;
        if ($storageRepository->loadField($table, $fieldKey)) {
            $isAvailable = false;
        }

        return new JsonResponse(['isAvailable' => $isAvailable]);
    }
public function checkFieldKey(ServerRequest $request, Response $response): Response
    {
        $queryParams = $request->getQueryParams();
        $fieldKey = $queryParams['key'];
        $table = 'tt_content';
        if (isset($queryParams['table'])) {
            $table = $queryParams['table'];
        }

        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
        $storageRepository = $objectManager->get(StorageRepository::class);

        // check if fieldKey is available for this table
        $isAvailable = true;
        if ($storageRepository->loadField($table, $fieldKey)) {
            $isAvailable = false;
        }

        return new JsonResponse(['isAvailable' => $isAvailable]);
    }
public function checkFieldKey ( ServerRequest $ request , Response $ response ) : Response { $ queryParams = $ request -> getQueryParams ( ) ; $ fieldKey = $ queryParams [ 'key' ] ; $ table = 'tt_content' ; if ( isset ( $ queryParams [ 'table' ] ) ) { $ table = $ queryParams [ 'table' ] ; } $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ storageRepository = $ objectManager -> get ( StorageRepository :: class ) ; // check if fieldKey is available for this table $ isAvailable = true ; if ( $ storageRepository -> loadField ( $ table , $ fieldKey ) ) { $ isAvailable = false ; } return new JsonResponse ( [ 'isAvailable' => $ isAvailable ] ) ; }
Checks if a key for a field is available
Checks if a key for a field is available