Y
Y
Yuri Matveenko2017-07-28 19:37:07
symfony
Yuri Matveenko, 2017-07-28 19:37:07

How to delete an entry with links?

f34bac088c524e35b6dd5b68d620913c.png14bbc9e982c64253986f16961d770af2.png
I actually remove it like this:

$em->remove($area);
 $em->flush();

I have a table with sites and applications
44d24ed0eb8942a5a196927ce2180cf2.pngbb03aea14b724470b6c835d0e8758093.png
Sites without applications are deleted

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GTRxShock, 2017-07-28
@letsrock_inita

I hope the point is clear:

class Application
{
/**
* @ORM\OneToMany(targetEntity="Area", mappedBy="application", cascade={"remove"})
*/
protected $areas;
//...
}

ps although it can also be tricky with connections, if they did it separately

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question