elcodi / bamboo

Meet Bamboo, an e-commerce project built on top of Elcodi and Symfony. Give us a star to support our project :)
http://bamboo.elcodi.com
MIT License
198 stars 44 forks source link

Saving the store address is not working #695

Open johnkrovitch opened 8 years ago

johnkrovitch commented 8 years ago

Hi,

I'm trying to change the address of the store, but nothing is happening. The backoffice says that the store is saved, but in database, no changes are done.

It seems like the relation between Store and Address is missing the cascade attribute, but even with this attribute, it is not working.

If someone has an idea. I try to make a PR if I find a solution.

Thanks

johnkrovitch commented 8 years ago

The problem seems to be in the StoreBundle\Controller\StoreController :

   /**
     * Save store and add success flash
     *
     * @param StoreInterface $store Store
     *
     * @return $this Self object
     */
    private function saveStoreAndAddFlash(StoreInterface $store)
    {
        // replacing this existing code
        $this
            ->get('elcodi.object_manager.store')
            ->flush($store);

        // by this one will save the address changes in database
        $this
            ->get('elcodi.object_manager.store')
            ->persist($store);

        $this
            ->get('elcodi.object_manager.store')
            ->flush();

        $this->addFlash(
            'success',
            'admin.store.saved'
        );

        return $this;
    }
johnkrovitch commented 8 years ago

It is maybe not the good place to make PR ?