New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a validator on URL entity #6906
base: 2.6
Are you sure you want to change the base?
Conversation
@@ -197,6 +197,8 @@ public function addEntryFormAction(Request $request, TranslatorInterface $transl | |||
// entry saved, dispatch event about it! | |||
$this->eventDispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME); | |||
|
|||
return $this->redirect($this->generateUrl('homepage')); | |||
} elseif ($form->isSubmitted() && !$form->isValid()) { | |||
return $this->redirect($this->generateUrl('homepage')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to have an error message here.
To be in this case, we have to change the type field via the web console (to have a text field, no more an URL one).
if (\count($errors) > 0) { | ||
$errorsString = (string) $errors; | ||
|
||
return $this->sendResponse($errorsString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if I have to return the error like that.
@@ -78,6 +78,9 @@ class Entry | |||
* @var string | |||
* | |||
* @Assert\NotBlank() | |||
* @Assert\Url( | |||
* message = "The url '{{ value }}' is not a valid url", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to translate this message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicosomb could you rebase and target the master branch please?
Fixes #6863