unsupportedAssociation example

$this->executeWriteOperation($definition$mapping$context, self::WRITE_DELETE);

            return $responseFactory->createRedirectResponse($definition$id$request$context);
        }

        if ($association instanceof OneToManyAssociationField) {
            $this->executeWriteOperation($definition['id' => $id]$context, self::WRITE_DELETE);

            return $responseFactory->createRedirectResponse($definition$id$request$context);
        }

        throw ApiException::unsupportedAssociation($association->getPropertyName());
    }

    /** * @return array{0: Criteria, 1: EntityRepository} */
    private function resolveSearch(Request $request, Context $context, string $entityName, string $path): array
    {
        $pathSegments = $this->buildEntityPath($entityName$path$context);
        $permissions = $this->validatePathSegments($context$pathSegments, AclRoleDefinition::PRIVILEGE_READ);

        /** @var EntityPathSegment $first */
        
public function testResolverNotFoundException(): void
    {
        $exception = ApiException::resolverNotFoundException('name');

        static::assertEquals(ApiException::API_RESOLVER_NOT_FOUND_EXCEPTION, $exception->getErrorCode());
        static::assertEquals('Foreign key resolver for key name not found', $exception->getMessage());
    }

    public function testUnsupportedAssociation(): void
    {
        $exception = ApiException::unsupportedAssociation('name');

        static::assertEquals(ApiException::API_UNSUPPORTED_ASSOCIATION_FIELD, $exception->getErrorCode());
        static::assertEquals('Unsupported association for field name', $exception->getMessage());
    }

    public function testMissingPrivileges(): void
    {
        $exception = ApiException::missingPrivileges(['read', 'write']);

        static::assertInstanceOf(MissingPrivilegeException::class$exception);
    }

    
Home | Imprint | This part of the site doesn't use cookies.