Skip to content
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

Open
wants to merge 1 commit into
base: 2.6
Choose a base branch
from
Open

Add a validator on URL entity #6906

wants to merge 1 commit into from

Conversation

nicosomb
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Documentation no
Translation no
CHANGELOG.md no
License MIT

Fixes #6863

@nicosomb nicosomb added this to the 2.6.6 milestone Aug 29, 2023
@@ -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'));
Copy link
Member Author

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);
Copy link
Member Author

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",
Copy link
Member Author

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.

@nicosomb nicosomb linked an issue Aug 29, 2023 that may be closed by this pull request
@nicosomb nicosomb removed this from the 2.6.6 milestone Sep 6, 2023
Copy link
Member

@Kdecherf Kdecherf left a 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The URL is not checked before saving it
2 participants