Skip to content
Snippets Groups Projects

Issue #2981047: Views does not support computed bundle fields

Closed Issue #2981047: Views does not support computed bundle fields
4 unresolved threads
4 unresolved threads
Files
11
@@ -5,6 +5,7 @@
@@ -5,6 +5,7 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Url;
use Drupal\Core\Url;
use Drupal\entity_test\Entity\EntityTestComputedField;
use Drupal\entity_test\Entity\EntityTestComputedField;
 
use Drupal\entity_test\Entity\EntityTestComputedFieldBundle;
use Drupal\user\Entity\User;
use Drupal\user\Entity\User;
/**
/**
@@ -72,6 +73,12 @@ protected function setUpAuthorization($method) {
@@ -72,6 +73,12 @@ protected function setUpAuthorization($method) {
* {@inheritdoc}
* {@inheritdoc}
*/
*/
protected function createEntity() {
protected function createEntity() {
 
$bundle = EntityTestComputedFieldBundle::create([
 
'name' => 'Entity Test Computed Field Bundle',
 
'type' => 'entity_test_computed_field',
 
'id' => 'entity_test_computed_field',
 
]);
 
$bundle->save();
$entity_test = EntityTestComputedField::create([
$entity_test = EntityTestComputedField::create([
'name' => 'Llama',
'name' => 'Llama',
'type' => 'entity_test_computed_field',
'type' => 'entity_test_computed_field',
@@ -89,6 +96,7 @@ protected function createEntity() {
@@ -89,6 +96,7 @@ protected function createEntity() {
protected function getExpectedDocument() {
protected function getExpectedDocument() {
$self_url = Url::fromUri('base:/jsonapi/entity_test_computed_field/entity_test_computed_field/' . $this->entity->uuid())->setAbsolute()->toString(TRUE)->getGeneratedUrl();
$self_url = Url::fromUri('base:/jsonapi/entity_test_computed_field/entity_test_computed_field/' . $this->entity->uuid())->setAbsolute()->toString(TRUE)->getGeneratedUrl();
$author = User::load(0);
$author = User::load(0);
 
$bundle = EntityTestComputedFieldBundle::load('entity_test_computed_field');
return [
return [
'jsonapi' => [
'jsonapi' => [
'meta' => [
'meta' => [
@@ -135,6 +143,19 @@ protected function getExpectedDocument() {
@@ -135,6 +143,19 @@ protected function getExpectedDocument() {
'self' => ['href' => $self_url . '/relationships/user_id'],
'self' => ['href' => $self_url . '/relationships/user_id'],
],
],
],
],
 
'entity_test_computed_field_type' => [
 
'data' => [
 
'id' => $bundle->uuid(),
 
'meta' => [
 
'drupal_internal__target_id' => 'entity_test_computed_field',
 
],
 
'type' => 'entity_test_comp_field_bundle--entity_test_comp_field_bundle',
 
],
 
'links' => [
 
'related' => ['href' => $self_url . '/entity_test_computed_field_type'],
 
'self' => ['href' => $self_url . '/relationships/entity_test_computed_field_type'],
 
],
 
],
],
],
],
],
];
];
Loading