Skip to content

[Collection Upload] Undefined variable: editable #12

@ksn135

Description

@ksn135

I'm on dev-master.
In vendor/symfony2admingenerator/form-extensions-bundle/Admingenerator/FormExtensionsBundle/Form/EventListener/CollectionUploadSubscriber.php at line 192

My config:

        files:
            label:                     Files
            dbType:               collection
            formType:             s2a_collection_upload
            addFormOptions:
                primary_key:          id
                nameable:             false
                nameable_field:       name
                sortable:             true
                sortable_field:       position
                editable:             [ description ]    
                type:               \Ksn135\CompanyBundle\Form\Type\Cabinet_file\EditType
                loadImageFileTypes:   /^image\/(gif|jpe?g|png)$/i
                previewMaxWidth:      100
                previewMaxHeight:     100
                previewAsCanvas:      true
                prependFiles:         false
                allow_add:            true
                allow_delete:         true
                error_bubbling:       false
                options:
                    data_class:       Ksn135\CompanyBundle\Entity\CabinetFile

My entity (almost the same as from example: https://github.com/symfony2admingenerator/FormExtensionsBundle/blob/master/Resources/doc/collection-upload/overview.md):

/**
 * @ORM\Table(name="cabinet_file")
 * @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
 * @Vich\Uploadable
 */
class CabinetFile implements UploadCollectionFileInterface
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @Vich\UploadableField(mapping="files", fileNameProperty="path")
     */
    protected $file;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $path;

    /**
     * (Optional) nameable field
     *
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $name;

    /**
     * (Optional) additional editable field
     *
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    protected $description;

    /**
     * @ORM\Column(name="category_id", type="integer")
     */
    private $categoryId;

    /**
     * (Optional) sortable group
     *
     * @Gedmo\SortableGroup
     * @ORM\ManyToOne(targetEntity="CabinetCategory", inversedBy="files")
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     */
    protected $category;

    /**
     * (Optional) sortable position
     *
     * @Gedmo\SortablePosition
     * @ORM\Column(name="position", type="integer")
     */
    protected $position;



    public function setFile(\Symfony\Component\HttpFoundation\File\File $file) {
        $this->file = $file;
        return $this;
    }

    public function getFile() {
        return $this->file;
    }

    public function getId() {
        return $this->id;
    }

    public function getCategoryId() {
        return $this->categoryId;
    }

    public function getPath() {
        return $this->path;
    }

    public function getName() {
        return $this->name;
    }

    public function getPosition() {
        return $this->position;
    }

    public function getDescription() {
        return $this->description;
    }

    public function getSize() {
        return $this->file->getFileInfo()->getSize();
    }

    public function setParent($parent) {
        $this->setCategory($parent);
    }

    public function getPreview() {
        return (preg_match('/image\/.*/i', $this->file->getMimeType()));
    }


    /**
     * Set path
     *
     * @param string $path
     * @return CabinetFile
     */
    public function setPath($path)
    {
        $this->path = $path;

        return $this;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return CabinetFile
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Set description
     *
     * @param string $description
     * @return CabinetFile
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Set position
     *
     * @param integer $position
     * @return CabinetFile
     */
    public function setPosition($position)
    {
        $this->position = $position;

        return $this;
    }

    /**
     * Get category
     *
     * @return \Ksn135\CompanyBundle\Entity\CabinetCategory 
     */
    public function getCategory()
    {
        return $this->category;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions