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

Collection/Fieldset problem after update 2.2.x to 2.5 #45

Open
michalbundyra opened this issue Jan 15, 2020 · 0 comments
Open

Collection/Fieldset problem after update 2.2.x to 2.5 #45

michalbundyra opened this issue Jan 15, 2020 · 0 comments

Comments

@michalbundyra
Copy link
Member

Hi,

Zend Framework updated to the version 2.5, then came to me mainly problems with collections.
At an earlier version 2.2.x all it worked normally but now I have a problem.

Debugging code form, specifically the data from the form, I found two types of data received.

2.2.x:

'descriptionTabs' => 
    array (size=2)
      0 => 
        array (size=5)
          'id' => int 1
          'name' => string 'raz' (length=3)
          'position' => int 0
          'content' => string '<p>22222222222222222</p>' (length=24)
          '_translation' => 
            array (size=1)
              'en_GB' => 
                array (size=1)

2.5

'descriptionTabs' => 
    array (size=2)
      0 => 
        array (size=5)
          'id' => int 1
          'name' => string 'raz' (length=3)
          'position' => int 0
          'content' => string '<p>22222222222222222</p>' (length=24)

In 2.5 I'dont see a field _translation, but forms on the front look the same field names as well.

Entity use

    /**
     * @Form\Attributes({"data-collection-max-count":5})
     * @ORM\OneToMany(targetEntity="CmsShop\Entity\Product\DescriptionTab", mappedBy="product",cascade={"all"})
     * @ORM\OrderBy({"position" = "ASC"})
     */
    protected $descriptionTabs;

Entity

class DescriptionTab implements Sortable {

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string",nullable=false)
     * @Gedmo\Translatable()
     */
    protected $name;

    /**
     * @Gedmo\SortablePosition
     * @ORM\Column(type="integer",nullable=true)
     * @Form\Type("hidden")
     */
    protected $position;

    /**
     * @Form\Type("html")
     * @Gedmo\Translatable()
     * @ORM\Column(type="text", nullable=true)
     */
    protected $content;

Anyone have any idea how to solve it?


Originally posted by @GyniO at zendframework/zend-form#73

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

1 participant