create trigger c_custom_field
after update
of custom_field
on contact
for each row
execute procedure contact_custom_field();
create function contact_custom_field() returns trigger
language plpgsql
as
$$
BEGIN
UPDATE contact
SET custom_field = NEW.custom_field
WHERE user_id = OLD.user_id;
RETURN NEW;
END;
$$;
create trigger c_custom_field
after update
of custom_field
on contact
for each row
execute procedure contact_custom_field();
create function contact_custom_field() returns trigger
language plpgsql
as
$$
BEGIN
UPDATE contact
SET custom_field = NEW.custom_field
WHERE user_id = OLD.user_id;
RETURN NEW;
END;
$$;
UPDATE contact
SET custom_field = '{"id":10,"value":780}'
WHERE id=785;
[54001] ERROR: stack depth limit exceeded Hint: Increase the configuration parameter "max_stack_depth" (currently 2048kB), after ensuring the platform's stack depth limit is adequate. Where: SQL statement "UPDATE contact SET custom_field = NEW.custom_field WHERE user_id = OLD.user_ ...
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): JsonResponse
{
return new JsonResponse(['error' => 'Authentication required'], 401);
}
access_control:
- { path: ^/page/cart, roles: PUBLIC_ACCESS }
<?php
namespace App\Security;
use App\Service\ApiTokenService;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
class ApiTokenAuthenticator extends AbstractGuardAuthenticator
{
private ApiTokenService $apiTokenService;
/**
* TokenAuthenticator constructor.
* @param ApiTokenService $apiTokenService
*/
public function __construct(ApiTokenService $apiTokenService)
{
$this->apiTokenService = $apiTokenService;
}
public function start(Request $request, AuthenticationException $authException = null): JsonResponse
{
return new JsonResponse(['error' => 'Authentication required'], 401);
}
public function supports(Request $request): bool
{
return $request->headers->has('Authorization');
}
public function getCredentials(Request $request)
{
return $request->headers->get('Authorization');
}
public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface
{
return $this->apiTokenService->getUserByToken($credentials);
}
public function checkCredentials($credentials, UserInterface $user): bool
{
return true;
}
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): JsonResponse
{
return new JsonResponse(['error' => 'Authentication required'], 401);
}
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)
{
return null;
}
public function supportsRememberMe(): bool
{
return false;
}
}