Skip to content

Instantly share code, notes, and snippets.

@nebkam
Last active June 15, 2022 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nebkam/c4737754dd5d88a826f10fc8f2bf02e2 to your computer and use it in GitHub Desktop.
Save nebkam/c4737754dd5d88a826f10fc8f2bf02e2 to your computer and use it in GitHub Desktop.
<?php
public function add($entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush)
{
$this->getEntityManager()->flush();
}
}
public function remove($entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush)
{
$this->getEntityManager()->flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment