Created
March 10, 2017 16:01
-
-
Save sheise/091f6cf9b2deb7b21c8c7c7eca81a7b4 to your computer and use it in GitHub Desktop.
ACF-323: workaround for admin errors on new field collection creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Entity/FieldCollectionItem.php b/src/Entity/FieldCollectionItem.php | |
index b3f7279..33f64ca 100644 | |
--- a/src/Entity/FieldCollectionItem.php | |
+++ b/src/Entity/FieldCollectionItem.php | |
@@ -329,6 +329,13 @@ public function getHostRevisionId() { | |
$query->range(0, 1); | |
$result = $query->execute()->fetch(); | |
+ // This is a workaround because when admins create applications | |
+ // on new hosts, code will get here and find no host causing errors. | |
+ // TODO: this should be fixed in a better way. | |
+ if (empty($result)) { | |
+ return; | |
+ } | |
+ | |
$this->host_revision_id = $result->revision_id; | |
if ($this->host_revision_id) { | |
$this->host_id = $result->entity_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment