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

Fix for "Argument 1 passed to FieldRepository::findAllBySlug() must be of the type string, null given" #2189

Merged
merged 1 commit into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/DataFixtures/ContentFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ private function loadField(Content $content, string $name, $fieldType, ContentTy

$field = FieldRepository::factory($fieldType, $name);

// Make sure to create the fixture in the correct default locale.
$field->setLocale($this->defaultLocale);

if (isset($preset[$name])) {
$field->setValue($preset[$name]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Listener/ContentFillListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private function guaranteeUniqueSLug(Content $content): void
$slugField = null;
}

$fields = $this->fieldRepository->findAllBySlug($slug);
$fields = $slug ? $this->fieldRepository->findAllBySlug($slug) : null;

if (! $fields) {
// No slug field with that slug exists. We're done here.
Expand Down