sonata-project / SonataNewsBundle

[Abandoned] Symfony SonataNewsBundle
https://docs.sonata-project.org/projects/SonataNewsBundle
MIT License
151 stars 131 forks source link

Problem to delete post via batch action #32

Closed glaporte closed 12 years ago

glaporte commented 13 years ago

Hello, when i try to delete a post via batch action i get this error.

Iterate with fetch join in class Application\Sonata\NewsBundle\Entity\Post using association tags not allowed.

Thank you for some help.

rande commented 12 years ago

This issue is linked to http://www.doctrine-project.org/jira/browse/DDC-1618

rande commented 12 years ago

The pending PR : https://github.com/doctrine/doctrine2/pull/271

glaporte commented 12 years ago

Thank you.

rande commented 12 years ago

The issue is not closed yet ;)

butt commented 12 years ago

yep, looks like this problem still exists. any ideas about how it can be solved? :)

rande commented 12 years ago

Please make sure you have the latest version of Doctrine : 2.1.6

butt commented 12 years ago

Thanks for the information, I have just checked - latest version of the Doctrine used.

After digging a while into problem I have located reasons - I got error when I try to use Datagrid Filters based on ManyToMany relations.

For example - I have entity article

    /**
* Vendors for article
*
* @ORM\ManyToMany(targetEntity="Vido\CoreBundle\Entity\Vendor")
* @ORM\JoinTable(name="articles_vendors",
* joinColumns={@ORM\JoinColumn(name="article_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="vendor_id", referencedColumnName="id")}
* )
*/
    public $vendors;

When I use code

protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('vendors')
        ;
    }

I got error

Iterate with fetch join in class Vido\CoreBundle\Entity\Article using association vendors not allowed.

when I comment that line like

protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
//            ->add('vendors')
        ;
    }

Batch action works fine.