-
-
Notifications
You must be signed in to change notification settings - Fork 756
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. no need to have an error message here. |
||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I have to translate this message. |
||
* ) | ||
* @ORM\Column(name="url", type="text", nullable=true) | ||
* | ||
* @Groups({"entries_for_user", "export_all"}) | ||
|
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.