Commit a96c1cc0 authored by APolitsin's avatar APolitsin
Browse files

fix presave bug

parent 8f183bac
......@@ -39,7 +39,10 @@ class EntityPresave extends ControllerBase {
$result = FALSE;
if (method_exists($entity, 'bundle')) {
if (property_exists($entity, 'name')) {
$result = $entity->bundle();
$reflector = new \ReflectionClass(get_class($entity));
if ($reflector->getProperty('name')->isPublic()) {
$result = $entity->bundle();
}
}
}
return $result;
......@@ -52,7 +55,10 @@ class EntityPresave extends ControllerBase {
$result = FALSE;
if (method_exists($entity, 'getType')) {
if (property_exists($entity, 'title')) {
$result = $entity->getType();
$reflector = new \ReflectionClass(get_class($entity));
if ($reflector->getProperty('title')->isPublic()) {
$result = $entity->getType();
}
}
}
return $result;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment