I don't really know how the form type works, but all entities involved in the save operation (flush) must either be managed (coming from the DB or part of a previous flush operation) or persisted explicitly.
On Fri, 24 Aug 2018, 02:29 , <[email protected]> wrote: > I try your solution, and other solution. > > My code : > https://gist.github.com/Benjaminret/b7126fa110dc3405e392d72bfb27ccc9 > > The last error : > > Doctrine\ORM\ORMInvalidArgumentException: > Multiple non-persisted new entities were found through the given association > graph: > > * A new entity was found through the relationship 'App\Entity\Abonnes#tag' > that was not configured to cascade persist operations for entity: > App\Entity\Tag@00000000153881de00000000735393ca. To solve this issue: Either > explicitly call EntityManager#persist() on this unknown entity or configure > cascade persist this association in the mapping for example > @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity > causes the problem implement 'App\Entity\Tag#__toString()' to get a clue. > * A new entity was found through the relationship 'App\Entity\Abonnes#tag' > that was not configured to cascade persist operations for entity: > App\Entity\Tag@00000000153881dc00000000735393ca. To solve this issue: Either > explicitly call EntityManager#persist() on this unknown entity or configure > cascade persist this association in the mapping for example > @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity > causes the problem implement 'App\Entity\Tag#__toString()' to get a clue. > > at vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php:105 > at > Doctrine\ORM\ORMInvalidArgumentException::newEntitiesFoundThroughRelationships(array(array(array('fieldName' > => 'tag', 'mappedBy' => 'abonnes', 'targetEntity' => 'App\\Entity\\Tag', > 'cascade' => array(), 'orphanRemoval' => false, 'fetch' => 2, 'type' => 4, > 'inversedBy' => null, 'isOwningSide' => false, 'sourceEntity' => > 'App\\Entity\\Abonnes', 'isCascadeRemove' => false, 'isCascadePersist' => > false, 'isCascadeRefresh' => false, 'isCascadeMerge' => false, > 'isCascadeDetach' => false), object(Tag)), array(array('fieldName' => 'tag', > 'mappedBy' => 'abonnes', 'targetEntity' => 'App\\Entity\\Tag', 'cascade' => > array(), 'orphanRemoval' => false, 'fetch' => 2, 'type' => 4, 'inversedBy' => > null, 'isOwningSide' => false, 'sourceEntity' => 'App\\Entity\\Abonnes', > 'isCascadeRemove' => false, 'isCascadePersist' => false, 'isCascadeRefresh' > => false, 'isCascadeMerge' => false, 'isCascadeDetach' => false), > object(Tag)))) > (vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:3443) > at > Doctrine\ORM\UnitOfWork->assertThatThereAreNoUnintentionallyNonPersistedAssociations() > (vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:362) > at Doctrine\ORM\UnitOfWork->commit(null) > (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:359) > at Doctrine\ORM\EntityManager->flush() > (src/Controller/FormulaireController.php:126) > at App\Controller\FormulaireController->add(object(Request)) > (vendor/symfony/http-kernel/HttpKernel.php:149) > at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) > (vendor/symfony/http-kernel/HttpKernel.php:66) > at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) > (vendor/symfony/http-kernel/Kernel.php:188) > at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) > (public/index.php:37) > > > Le jeudi 23 août 2018 18:55:23 UTC+2, [email protected] a écrit : >> >> Hi, >> >> I read all I can read about this topic. >> I try, try, try ... >> >> I want to create Users (named : abonnes) >> And User can choose many training (formations), many skills (tags) and >> many professional experiences (experience) >> But JoinColumn never works ... >> >> I use Doctrine on Symfony >> >> Anyone can help me please ? >> Thanks >> >> -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
