getSchema is not able to fetch asset when schema is empty

Created on 1 March 2023, over 1 year ago
Updated 13 March 2023, over 1 year ago

Problem/Motivation

The function getSchema in the class Drupal\patternkit\Entity\Pattern is checking if the schema is value with isset($schema). But schema is always defined and never null it's a Drupal\Core\Field\FieldItemList.

$schema = $this->get('schema');
    if (!isset($schema)) {
         $this->fetchAssets();
    }

Proposed resolution

  $item = $this->get('schema')->first();
    if (empty($item)) {
      $this->fetchAssets();
      $item = $this->get('schema')->first();
    }
πŸ› Bug report
Status

Fixed

Version

9.1

Component

Module Core

Created by

πŸ‡«πŸ‡·France churel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024