0

I have a ManyToMany Relation (AdditionalCostTemplate>Accommodation) and i have a custom formtype extending EntityType to fill the Accommodations in my AdditionalCostTemplate.

If i use the default symfony2 EntityType Formtype, it all works well. If i use my custom EntityType it wraps my Accommodation Entities in an additional ArrayCollection. Now i stripped my custom entity to just having a different name, nothing else. The error still appears.

My Annotations:

/**
 * AdditionalCostTemplate
 *
 * @ORM\Table()
 * @ORM\Entity()
 */
class AdditionalCostTemplate
{
    /**
     * @var PersistentCollection
     *
     * @ORM\ManyToMany(targetEntity="Acme\AccommodationBundle\Entity\Accommodation", cascade={"persist", "remove"}, orphanRemoval=true)
     */
    private $accommodations;
    [...]

My Entity FormType:

class CallbackEntityType extends EntityType
{
    public function getParent()
    {
        return 'entity';
    }

    public function getName()
    {
        return 'acme_callback_entity_type';
    }
}

Anyone any ideas?

1 Answer 1

1

Not sure but could it be because you're both extending the entity type and defining it as parent?

Try replacing the extends EntityType with extends AbstractType...

Sign up to request clarification or add additional context in comments.

1 Comment

I am also "not sure" why that causes the Problem but it DID cause the Problem. Thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.