Skip to content

Instantly share code, notes, and snippets.

@stepansib
Created April 5, 2019 06:16
Show Gist options
  • Save stepansib/8cb20c2adc56cc37ce8d8c807d505daa to your computer and use it in GitHub Desktop.
Save stepansib/8cb20c2adc56cc37ce8d8c807d505daa to your computer and use it in GitHub Desktop.
#oro get entity attachments
/**
* @Route("/attach", name="crm_debug_attach")
*/
public function attachAction(Request $request)
{
$this->checkAdmin();
$project = $this->getEntityManager()->getRepository(Project::class)->find(65);
$entityClass = $this->get('oro_entity.routing_helper')->resolveEntityClass(Project::class);
$entityField = ExtendHelper::buildAssociationName($entityClass);
VarDumper::dump(
$this->getEntityManager()->getRepository(Attachment::class)->findBy([
$entityField => $project->getId(),
]));
die();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment