From f6dcf5a149fcd2d7fccd9fd456e41bfbdfa94733 Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Wed, 21 Dec 2016 11:37:19 -0600 Subject: [PATCH] Correctly get parent (#17) * Correctly get parent * Use the getFedoraRoot function to return NULL * Incorrect function name --- islandora/src/Entity/FedoraResource.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/islandora/src/Entity/FedoraResource.php b/islandora/src/Entity/FedoraResource.php index ac59060a..24b21294 100644 --- a/islandora/src/Entity/FedoraResource.php +++ b/islandora/src/Entity/FedoraResource.php @@ -235,21 +235,30 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac * {@inheritdoc} */ public function hasParent() { - return ($this->get('fedora_has_parent') !== NULL); + return ($this->get('fedora_has_parent')->first() !== NULL); } /** * {@inheritdoc} */ public function getParent() { - return $this->get('fedora_has_parent')->getEntity(); + return $this->get('fedora_has_parent') + ->first() + ->get('entity') + ->getTarget() + ->getValue(); } /** * {@inheritdoc} */ public function getParentId() { - return $this->get('fedora_has_parent')->getEntity()->id(); + return $this->get('fedora_has_parent') + ->first() + ->get('entity') + ->getTarget() + ->getValue() + ->id(); } /** @@ -270,7 +279,7 @@ class FedoraResource extends ContentEntityBase implements FedoraResourceInterfac */ public static function getFedoraRoot() { // Just stub code, we need to figure out what "root is" in this context. - return array('root'); + return NULL; } /**