public function getEntity($entity)
{
$bTree = false;
$parentClass = 'PartKeepr.data.HydraModel';
$entity = $this->convertExtJSToPHPClassName($entity);
$cm = $this->em->getClassMetadata($entity);
if ($cm->getReflectionClass()->isSubclassOf("PartKeepr\\CategoryBundle\\Entity\\AbstractCategory")) {
$parentClass = 'PartKeepr.data.HydraTreeModel';
$bTree = true;
}
$fieldMappings = [];
$fieldMappings = array_merge($fieldMappings, $this->getVirtualFieldMappings($cm));
$fieldMappings = array_merge($fieldMappings, $this->getDatabaseFieldMappings($cm));
$associationMappings = $this->getDatabaseAssociationMappings($cm, $bTree);
$renderParams = ['fields' => $fieldMappings, 'associations' => $associationMappings, 'className' => $this->convertPHPToExtJSClassName($entity), 'parentClass' => $parentClass];
$targetService = $this->reader->getClassAnnotation($cm->getReflectionClass(), "PartKeepr\\DoctrineReflectionBundle\\Annotation\\TargetService");
if ($targetService !== null) {
$renderParams['uri'] = $targetService->uri;
}
$ignoreIds = $this->reader->getClassAnnotation($cm->getReflectionClass(), "PartKeepr\\DoctrineReflectionBundle\\Annotation\\IgnoreIds");
if ($ignoreIds !== null) {
$renderParams['ignoreIds'] = true;
} else {
$renderParams['ignoreIds'] = false;
}
return $this->templateEngine->render('PartKeeprDoctrineReflectionBundle::model.js.twig', $renderParams);
}