Skip to content
Advertisement

Tag: symfony

jwt token not found when i pass in username and password in curl

I want to use jwt token in my symfony project. But i have a problem because when i use: curl.exe -X POST -H “Content-Type: application/json” http://localhost:81/api/login_check -d ‘{“username”: “f.djawid@outlook.com”,”password”:”000000″}’ I get : {“code”:401,”message”:”JWT Token not found”} This is my security.yml: As you can see i use the lexikJWTAthenticationBundle. I made a private key and public key with ssl. I use

Symfony access headers in custom validator constraint

I am trying to access the headers of my request in a custom validator constraint like so: But the headerBag in $this->request is always an empty array unfortunately. Is there maybe an issue because I extend the symfony count validator? Answer You should ingest RequestStack instead of Request See the documentation

Dynamic embedded form with OneToOne relationship

I’m trying to create a form for an article with an addon (tender). The article is in one-to-one relationship with the addon and the addon can be disabled (null). If the checkbox with an addon is checked, the addon needs to be validated, then submitted together with the article. The issue I’m having is, I’m unable to set the addon

PHP – Multiple OR operators in if statement

I am working with getters and setters within my Symfony project. I have to use if() statement to check if status field does not have specific values before changing other field. Code: I defined constants and also using OR operator. I was wondering if there is more elegant solution than this. Maybe is_array() function, but don’t know can it be

Change parent format from @Template to render

When updating the app from Symfony 2.8 to Symfony 3.4, the handling of _format changed, so I would like to change @Template to render as shown in the post below. However, because twig is changed in Parent format Unable to specify twig file in return of BaseStaffController.php. Is there any good way? How to reference multiple twigs with @Template() Controller

How can I access the URL of a Symfony Http Client response?

With the Symfony Http Client I create a HTTP request like this: The output is: Now I try to output the url of that response: But the output is null. How can I get as an output the url www.something.com? Answer All the HttpClient responses implement the ResponseInterface, defined on Symfony Contracts. That interface declares a getInfo() method, as shown

Advertisement