Prestashop: Bug Persist Entity AttributeGroupLang : Bad Association Annotation

Created on 9 Oct 2018  路  3Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
When i tried to persist PrestaShopBundle\Entity\AttributeGroupLang entity, i had this exception

Catchable Fatal Error: Object of class PrestaShopBundle\Entity\Lang could not be converted to string

To Reproduce
Steps to reproduce the behavior:

$attributeGroupLang = new AttributeGroupLang();
$attributeGroupLang->setName("Group Test");
$attributeGroupLang->setPublicName("Group Test Public Name");
$attributeGroupLang->setLang($lang);
$attributeGroupLang->setAttributeGroup($attributeGroup);

$em->persist($attributeGroupLang);

Resolve this issue
I resolved this issue by remove one line on the $lang attribute annotation in the AttributeGroupLang Entity

Before

    /**
     * @ORM\Id
     * @ORM\Column(name="id_lang", type="integer")
     * @ORM\ManyToOne(targetEntity="PrestaShopBundle\Entity\Lang")
     * @ORM\JoinColumn(name="id_lang", referencedColumnName="id_lang", nullable=false, onDelete="CASCADE")
     */
    private $lang;

After

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="PrestaShopBundle\Entity\Lang")
     * @ORM\JoinColumn(name="id_lang", referencedColumnName="id_lang", nullable=false, onDelete="CASCADE")
     */
    private $lang;

Additionnal information
PrestaShop version: 1.7.5.x
PHP version: 7.1.13

1.7.5.x Attributes Bug CO

Most helpful comment

Hello @Fabuloops
You can follow the steps as mentioned here, https://github.com/PrestaShop/PrestaShop/blob/develop/CONTRIBUTING.md

All 3 comments

Hi @Fabuloops,

Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!

Hi @khouloudbelguith,

Sorry, i'm too much busy for the moment. Maybe later

I have to follow this tutorial right ?
https://devdocs.prestashop.com/1.7/contribute/contribute_using_docker/

Hello @Fabuloops
You can follow the steps as mentioned here, https://github.com/PrestaShop/PrestaShop/blob/develop/CONTRIBUTING.md

Was this page helpful?
0 / 5 - 0 ratings