ZfcUserAdmin icon indicating copy to clipboard operation
ZfcUserAdmin copied to clipboard

Adding custom form elements with Doctrine mapping / relationships fail

Open webdevilopers opened this issue 12 years ago • 0 comments

I try to add custom form elements using the module options.

My User entity:

class User implements UserInterface, ProviderInterface
{
    /**
     * @var int
     * @ORM\Id
     * @ORM\Column(name="user_id", type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     * @ORM\Column(type="string", length=255, unique=true, nullable=true)
     */
    protected $username;

    /**
     * @var string
     * @ORM\Column(type="string", unique=true,  length=255)
     */
    protected $email;

    /**
     * @var string
     * @ORM\Column(name="display_name", type="string", length=50, nullable=true)
     */
    protected $displayName;

    /**
     * @var string
     * @ORM\Column(type="string", length=128)
     */
    protected $password;

    /**
     * @var int
     */
    protected $state;

    /**
     * @var \Doctrine\Common\Collections\Collection
     * @ORM\ManyToMany(targetEntity="Application\Entity\Role")
     * @ORM\JoinTable(name="user_role_linker",
     *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="user_id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="role_id")}
     * )
     */
    protected $roles;

    /**
     * @var \Doctrine\Common\Collections\Collection
     * @ORM\ManyToMany(targetEntity="Application\Entity\CostCenter")
     * @ORM\JoinTable(name="user_costCenter",
     *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="user_id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="costCenter_id", referencedColumnName="id")}
     * )
     */
    private $costCenters;

    public function __construct()
    {
        $this->roles = new ArrayCollection();
        $this->costCenters = new ArrayCollection();
    }

    /* correct getters and setters */

My module options

    'create_form_elements' => array(
        'Email' => 'email',
        'Cost centers' => 'costCenters'
    ),
    'edit_form_elements' => array(
        'Email' => 'email',
        'Cost centers' => 'costCenters'
    )

The ZfcUserAdmin\Form\CreateUser form correctely creates a text element.

The ZfcUserAdmin\Form\EditUser shows the following error: Object provided to Escape helper, but flags do not allow recursion

webdevilopers avatar Jun 19 '13 12:06 webdevilopers