zend-form icon indicating copy to clipboard operation
zend-form copied to clipboard

Collection/Fieldset problem after update 2.2.x to 2.5

Open GyniO opened this issue 9 years ago • 1 comments

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?

GyniO avatar May 18 '16 04:05 GyniO

This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at https://github.com/laminas/laminas-form/issues/45.

michalbundyra avatar Jan 15 '20 19:01 michalbundyra