camelCaseToSnailCase example



        return new Response(null, Response::HTTP_NO_CONTENT, $headers);
    }

    abstract protected function getApiBaseUrl(Request $request): string;

    protected function getEntityBaseUrl(Request $request, EntityDefinition $definition): string
    {
        $apiCase = $this->getApiBaseUrl($request);

        return $apiCase . '/' . $this->camelCaseToSnailCase($definition->getEntityName());
    }

    /** * @template TEntityCollection of EntityCollection * * @param EntitySearchResult<TEntityCollection> $searchResult * @param array<string, mixed> $parameters * * @return array{first?: string, prev?: string, next?: string, last?: string} */
    protected function createPaginationLinks(EntitySearchResult $searchResult, string $uri, array $parameters): array
    {
return $this->formatToJson($result);
    }

    protected function serializeEntity(ResponseFields $fields, Entity $entity, EntityDefinition $definition, JsonApiEncodingResult $result, bool $isRelationship = false): void
    {
        if ($result->containsInData($entity->getUniqueIdentifier()$definition->getEntityName())
            || ($isRelationship && $result->containsInIncluded($entity->getUniqueIdentifier()$definition->getEntityName()))
        ) {
            return;
        }

        $self = $result->getBaseUrl() . '/' . $this->camelCaseToSnailCase($definition->getEntityName()) . '/' . $entity->getUniqueIdentifier();

        $serialized = clone $this->createSerializedEntity($fields$definition$result);
        $serialized->addLink('self', $self);
        $serialized->merge($entity);

        // add included entities         $this->serializeRelationships($fields$serialized$entity$result);

        $this->addExtensions($fields$serialized$entity$result);

        if ($isRelationship) {
            
Home | Imprint | This part of the site doesn't use cookies.