Zend Framework Doctrine使用ManyToMany创建实体

I'm using Zend Framework 2 with Doctrine.

I have two entities with ManyToMany relations, Portfolio and Tag.

When I'm editing Portfolio, I use select2 and I have possibility to not only select existing Tags, but also create new Tag from text input.

Can someone give me advice how to implement creation of new Tag? Seems like this case (zf2, doctrine, select2) is typical. Is there built-in methods to create new entities?

Logically Many to Many relationships should be resolved into One to Many with a new table.

if you can post your table schema I will create you the complete model/entity.