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

Catchable Fatal Error: Argument 2 passed to Vich\UploaderBundle\Metadata\Driver\YamlDriver::guessClassName() must be of the type array, string given, called in /Users/uthopiko/Developer/agenda/vendor/vich/uploader-bundle/Metadata/Driver/YamlDriver.php on line 40 and defined #490

Closed
uthopiko opened this issue Jan 2, 2016 · 9 comments
Milestone

Comments

@uthopiko
Copy link

uthopiko commented Jan 2, 2016

I am trying to use VichUpload but i have a problem with configuration. When i execute doctrine:schema:update throws me the following error.

[Symfony\Component\Debug\Exception\ContextErrorException]
  Catchable Fatal Error: Argument 2 passed to Vich\UploaderBundle\Metadata\Driver\YamlDriver::guessClassName() must be of the type array, string given,
  called in /Users/uthopiko/Developer/agenda/vendor/vich/uploader-bundle/Metadata/Driver/YamlDriver.php on line 40 and defined. 

I am using SF3. The configuration is:

    type: entity
    table: concert
    indexes:
        group_id:
            columns:
                - group_id
        municipio_id:
            columns:
                - municipio_id
        register_id:
            columns:
                - register_id
    id:
        id:
            type: integer
            nullable: false
            options:
                unsigned: false
            id: true
            generator:
                strategy: IDENTITY
    fields:
        title:
            type: string
            nullable: false
            length: 255
            options:
                fixed: false
        date:
            type: datetime
            nullable: false
        normalImage: string
    manyToOne:
        group:
            targetEntity: MusicGroup
            cascade: {  }
            fetch: LAZY
            mappedBy: null
            inversedBy: null
            joinColumns:
                group_id:
                    referencedColumnName: id
            orphanRemoval: false
        municipio:
            targetEntity: Municipios
            cascade: {  }
            fetch: LAZY
            mappedBy: null
            inversedBy: null
            joinColumns:
                municipio_id:
                    referencedColumnName: id
            orphanRemoval: false
        register:
            targetEntity: User
            cascade: {  }
            fetch: LAZY
            mappedBy: null
            inversedBy: null
            joinColumns:
                register_id:
                    referencedColumnName: id
            orphanRemoval: false
    lifecycleCallbacks: {  }
<?php

namespace AppBundle\Entity;

/**
 * Concert
 */
class Concert
{
 ....
    /**
     * @var string
     */
    protected $normalImage;

    /**
     * @var File $image
     */
    protected $image;
....
    /**
     * Set normalImage
     *
     * @param string $normalImage
     * @return Image
     */
    public function setNormalImage($normalImage)
    {
        $this->normalImage = $normalImage;
        return $this;
    }
    /**
     * Get normalImage
     *
     * @return string
     */
    public function getNormalImage()
    {
        return $this->normalImage;
    }
    public function setImage(File $image = null)
    {
        $this->image = $image;
        return $this;
    }
    public function getImage()
    {
        return $this->image;
    }
 ...
}
    image:
        mapping:           concert
        filename_property: normal_image```

vich_uploader:
db_driver: orm # or mongodb or propel or phpcr
mappings:
concert:
uri_prefix: /images/concert
upload_destination: %kernel.root_dir%/../web/images/concert

@K-Phoen K-Phoen modified the milestone: 1.0.0 Jan 8, 2016
@garak
Copy link
Collaborator

garak commented Jan 12, 2016

I just tried you mapping and I can't reproduce your error: updating the schema is working, I get the table in mysql.
Tried with Symfony 3.0.1 and VichUploaderBundle dev-master (just installed the bundle in Symfony standard edition)

@ghost
Copy link

ghost commented Jan 20, 2016

Cannot reproduce this issue with Symfony 3. I think we should remove the milestone from this issue until it is reproducible.

@jacmba
Copy link

jacmba commented Feb 4, 2016

No news yet?

I'm having the same issue with Symfony 3.0.2.

@ghost
Copy link

ghost commented Feb 4, 2016

@jacmba Could you explain how to reproduce this issue?
Will it be fixed with this commit? https://github.com/visionappscz/VichUploaderBundle/commit/ff2fa995194a7417cec08bc7c395f3317bd7245a

@mbohal
Copy link
Contributor

mbohal commented Feb 5, 2016

@JHGitty Im the author of the linked commit. Should I submit a PR?

@JarJak
Copy link

JarJak commented Feb 6, 2016

Same problem here, Symfony 3.0.2. @mbohal your fix works, submit PR please.

@ghost
Copy link

ghost commented Feb 7, 2016

@mbohal As @JarJak confirmed your fix works. So please submit a PR.

@mbohal
Copy link
Contributor

mbohal commented Feb 8, 2016

PR is here: #526

K-Phoen added a commit that referenced this issue Feb 8, 2016
Fix loading configuration from yaml, see: #490
@K-Phoen
Copy link
Collaborator

K-Phoen commented Feb 8, 2016

Should be fixed now.

@K-Phoen K-Phoen closed this as completed Feb 8, 2016
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

6 participants