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

Assets does not included for embedded crud form fields #6245

Open
zorn-v opened this issue Apr 5, 2024 · 1 comment
Open

Assets does not included for embedded crud form fields #6245

zorn-v opened this issue Apr 5, 2024 · 1 comment

Comments

@zorn-v
Copy link
Contributor

zorn-v commented Apr 5, 2024

Describe the bug
If you have collection (for example) with useEntryCrudForm and in that form you have some fields with added assets (e.g. ImageField), that assets does not included in result html page.

To Reproduce
Create entities like

<?php

namespace App\Entity;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
class Parent
{
    #[ORM\OneToMany(mappedBy: 'parent', targetEntity: Child::class, orphanRemoval: true, cascade: ['persist', 'remove'])]
    public Collection $child;
}
<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
class Child
{
    #[ORM\ManyToOne(inversedBy: 'child')]
    #[ORM\JoinColumn(nullable: false)]
    public ?Parent $parent = null;

    #[ORM\Column(length: 255, nullable: true)]
    public ?string $photo = null;
}

and crud controllers like

// Parent
    public function configureFields(string $pageName): iterable
    {
        return [
            CollectionField::new('child')
                ->useEntryCrudForm()
        ];
    }
//...
// Child
    public function configureFields(string $pageName): iterable
    {
        return [
            ImageField::new('photo')
        ];
    }
//...

You will see that field-image.js and field-file-upload.js does not included in result html page.
In fact it will not change file title for example when you select file for upload etc.

@zorn-v
Copy link
Contributor Author

zorn-v commented Apr 5, 2024

As workaround, include that assets in parent crud controller explicitly.

@zorn-v zorn-v changed the title Assets does not include for embedded crud form fields Assets does not included for embedded crud form fields Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant