Discussion:
[doctrine-user] Help for Association Mapping, please (->
b***@gmail.com
2018-08-23 16:55:23 UTC
Permalink
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
Marco Pivetta
2018-08-23 16:59:35 UTC
Permalink
Heya,

Could you maybe reduce your examples to something that fits in a mail? What
is not working about JoinColumn? Also, do you really need to define a join
column? That's usually for later on, when you already built up some
experience with the ORM.
Post by b***@gmail.com
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
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
b***@gmail.com
2018-08-23 19:37:41 UTC
Permalink
Tanks for your advises.
I know SQL, but I dont understand the links in doctrine.
More i visite website, more I am confused ...
I wish only do a simple link.
(See attached image)

Thanks
Post by b***@gmail.com
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
Marco Pivetta
2018-08-23 20:24:54 UTC
Permalink
This would be something like:

class User {
/** @ORM\Id() @ORM\Column() */
public $id;
/** @ORM\OneToMany(targetEntity=Skill::class, mappedBy="user") */
public $skills;
public function __construct() { $this->skills = new ArrayCollection(); }
}

class Skill {
/** @ORM\Id() @ORM\Column() */
public $id;
/** @ORM\ManyToOne(targetEntity=User::class, inversedBy="skills") */
public $skills;
}



Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/
Post by b***@gmail.com
Tanks for your advises.
I know SQL, but I dont understand the links in doctrine.
More i visite website, more I am confused ...
I wish only do a simple link.
(See attached image)
Thanks
Post by b***@gmail.com
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
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
b***@gmail.com
2018-08-24 00:05:10 UTC
Permalink
Thanks, but nothing works ...
Post by b***@gmail.com
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
Marco Pivetta
2018-08-24 00:12:46 UTC
Permalink
Can you be more specific about "nothing works"? Can you maybe put up an
example script on gist.github.com?
Post by b***@gmail.com
Thanks, but nothing works ...
Post by b***@gmail.com
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
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
b***@gmail.com
2018-08-24 00:29:12 UTC
Permalink
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\***@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\***@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)
Post by b***@gmail.com
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
Marco Pivetta
2018-08-24 00:40:05 UTC
Permalink
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.
Post by b***@gmail.com
I try your solution, and other solution.
https://gist.github.com/Benjaminret/b7126fa110dc3405e392d72bfb27ccc9
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)
Post by b***@gmail.com
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
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
b***@gmail.com
2018-08-24 00:55:46 UTC
Permalink
I understand.
I updated the document with the form.
I would like to persist in the entity...
Post by b***@gmail.com
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 doctrine-user+***@googlegroups.com.
To post to this group, send email to doctrine-***@googlegroups.com.
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...