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

Cannot assign string to property Doctrine\ORM\Mapping\JoinColumnMapping::$nullable of type ?bool and Roadrunner runtime #36

Open
amvid opened this issue Jun 20, 2024 · 0 comments

Comments

@amvid
Copy link

amvid commented Jun 20, 2024

Hello!

I was facing this error on bin/console doctrine:migrations:diff command:

Cannot assign string to property Doctrine\ORM\Mapping\JoinColumnMapping::$nullable of type ?bool

and the code below fixed the issue. I also tried to reproduce it with a new symfony skeleton project 6.4 with no luck...

use Adeliom\EasyMediaBundle\Entity\Folder as BaseFolder;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: 'easy_media__folder')]
class Folder extends BaseFolder
{
    #[ORM\ManyToOne(targetEntity: Folder::class, inversedBy: 'children')]
    #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', nullable: true)]
    protected ?BaseFolder $parent = null;

    /**
     * @var Collection<self>
     */
    #[ORM\OneToMany(targetEntity: Folder::class, mappedBy: 'parent')]
    protected Collection $children;

    /**
     * @var Collection<Media>
     */
    #[ORM\OneToMany(targetEntity: Media::class, mappedBy: 'folder')]
    protected Collection $medias;
}

Not a big deal, reported it here just in case, maybe you could add attributes to those fields in the BaseFolder.

The second issue is critical - I am using Roadrunner as a runtime and after debugging for few hours I found that the function move_uploaded_file is not working. Could you please use UploadedFile->move() something like that:

$chunkFile = sprintf('%s/%s.part%d', $fileChunksFolder, $filename, $chunkInd);
$file = $request->files->get('file');
// if (!move_uploaded_file($tmpFilePath, $chunkFile)) {
if (!$file->move($fileChunksFolder, $filename . '.part' . $chunkInd)) {
    $errors[] = ['text' => 'Move error', 'name' => $filename, 'index' => $chunkInd];
}

The code above works in my case and probably shouldn't break anything.

I could make a PR if you confirm that these changes would work as expected.

Btw thanks for this bundle and your time!

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