Problem/Motivation

Trying out the module.

Issue fork wotapi-3253838

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

  • 3253838-trying-out Comparecompare

Comments

sanduhrs created an issue. See original summary.

sanduhrs’s picture

diff --git a/wotapi.module b/wotapi.module
index 2165bb3..4bc5ab4 100644
--- a/wotapi.module
+++ b/wotapi.module
@@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\field\FieldConfigInterface;
-use Drupal\wotapi\Routing\Routes as WotApiRoutes;
diff --git a/wotapi.module b/wotapi.module
index 2165bb3..4bc5ab4 100644
--- a/wotapi.module
+++ b/wotapi.module
@@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\field\FieldConfigInterface;
-use Drupal\wotapi\Routing\Routes as WotApiRoutes;
+use Drupal\wotapi\Routing\Routes;
sanduhrs’s picture

diff --git a/wotapi.services.yml b/wotapi.services.yml
index 644abda..cc93abf 100644
--- a/wotapi.services.yml
+++ b/wotapi.services.yml
@@ -152,7 +152,7 @@ services:
   # Deprecated services.
   serializer.normalizer.htt_exception.wotapi:
     alias: serializer.normalizer.http_exception.wotapi
-    deprecated: The "%service_id%" service is deprecated. You should use the 'serializer.normalizer.http_exception.wotapi' service instead.
+    deprecated: The "%alias_id%" service is deprecated. You should use the 'serializer.normalizer.http_exception.wotapi' service instead.
sanduhrs’s picture

diff --git a/src/Entity/ThingType.php b/src/Entity/ThingType.php
index 3faefd7..ec4af0c 100644
--- a/src/Entity/ThingType.php
+++ b/src/Entity/ThingType.php
@@ -30,6 +30,12 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
  *     "label" = "label",
  *     "uuid" = "uuid"
  *   },
+ *   config_export = {
+ *     "id",
+ *     "label",
+ *     "uuid",
+ *     "at_type",
+ *   },
  *   links = {
  *     "canonical" = "/admin/structure/wotapi_thing_type/{wotapi_thing_type}",
  *     "add-form" = "/admin/structure/wotapi_thing_type/add",
sanduhrs’s picture

diff --git a/src/WotApiResource/ResourceObject.php b/src/WotApiResource/ResourceObject.php
index 747f866..8b0caf5 100644
--- a/src/WotApiResource/ResourceObject.php
+++ b/src/WotApiResource/ResourceObject.php
@@ -261,13 +261,7 @@ class ResourceObject implements CacheableDependencyInterface, ResourceIdentifier
       array_keys($fields),
       [$resource_type, 'isFieldEnabled']
     );
-
-    // The "label" field needs special treatment: some entity types have a label
-    // field that is actually backed by a label callback.
-    $entity_type = $entity->getEntityType();
-    if ($entity_type->hasLabelCallback()) {
-      $fields[static::getLabelFieldName($entity)]->value = $entity->label();
-    }
+    $fields[static::getLabelFieldName($entity)]->value = $entity->label();
 
     // Return a sub-array of $output containing the keys in $enabled_fields.
     $input = array_intersect_key($fields, array_flip($enabled_field_names));
sanduhrs’s picture

diff --git a/src/Controller/EntityResource.php b/src/Controller/EntityResource.php
index 648913a..b312093 100644
--- a/src/Controller/EntityResource.php
+++ b/src/Controller/EntityResource.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\wotapi\Controller;
 
-use Drupal\wotapi_action\Object\Request as ActionRequest;
+use Drupal\wotapi\Object\Request as ActionRequest;
 use Drupal\Component\Datetime\TimeInterface;
 use Drupal\Component\Serialization\Json;
 use Drupal\Core\Cache\CacheableMetadata;
diff --git a/src/Normalizer/AnnotationNormalizer.php b/src/Normalizer/AnnotationNormalizer.php
index 1291332..bdceaaf 100644
--- a/src/Normalizer/AnnotationNormalizer.php
+++ b/src/Normalizer/AnnotationNormalizer.php
@@ -4,7 +4,7 @@ namespace Drupal\wotapi\Normalizer;
 
 use Drupal\Component\Annotation\AnnotationInterface;
 use Drupal\Component\Assertion\Inspector;
-use Drupal\wotapi_action\Annotation\WotapiAction;
+use Drupal\wotapi\Annotation\WotapiAction;
 use Drupal\serialization\Normalizer\NormalizerBase;
sanduhrs’s picture

diff --git a/src/Normalizer/ResourceObjectNormalizer.php b/src/Normalizer/ResourceObjectNormalizer.php
index cf9f22e..477c1e7 100644
--- a/src/Normalizer/ResourceObjectNormalizer.php
+++ b/src/Normalizer/ResourceObjectNormalizer.php
@@ -136,7 +136,8 @@ class ResourceObjectNormalizer extends NormalizerBase {
    *
    */
   public function isActionField($field_name, $field) {
-    if ($field->getFieldDefinition()->getType() == 'wotapi_action') {
+    if (is_object($field)
+        && $field->getFieldDefinition()->getType() == 'wotapi_action') {
       return TRUE;
     }
     return FALSE;
q

  • sanduhrs committed 0ba7138 on 2.0.x
    Issue #3253838 by sanduhrs: Remove routes import alias
    
  • sanduhrs committed 22ba7d9 on 2.0.x
    Issue #3253838 by sanduhrs: Rename config files to prevent warnings
    
  • sanduhrs committed 56d04b7 on 2.0.x
    Issue #3253838 by sanduhrs: Fix deprecation notice
    
  • sanduhrs committed 81a284e on 2.0.x
    Issue #3253838 by sanduhrs: Add wotapi_thing_type config_export...
  • sanduhrs committed 8791c29 on 2.0.x
    Issue #3253838 by sanduhrs: Fix namespaces
    
  • sanduhrs committed 8d7b55b on 2.0.x
    Issue #3253838 by sanduhrs: EntityType::hasLabelCallback has been...
  • sanduhrs committed aeaf408 on 2.0.x
    Issue #3253838 by sanduhrs: Update inline object documentation
    
  • sanduhrs committed df9c9c1 on 2.0.x
    Issue #3253838 by sanduhrs: Fix action field identification
    
dravenk’s picture

Status: Active » Fixed

Thank you. @sanduhrs

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.