Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300812

PHP error when POSTing content entities without a "canonical" link template

$
0
0

Problem/Motivation

When you try to create an entity through REST and it doesn't have defined a canonical URL, it returns:

No link template "canonical" found for the "paragraph" entity type.

Proposed resolution

The Post method from EntityResource assumes that the created entity has an url and try to return it:

        $url = $entity->urlInfo('canonical', ['absolute' => TRUE])->toString(TRUE);
        return new ModifiedResourceResponse($entity, 201, ['Location' => $url->getGeneratedUrl()]);

The attached patch checks first it there is a canonical URL.

Remaining tasks

* Review

User interface changes

None

API changes

Post method for entity resource shouldnt try to return the entity URL if it doesnt have one.

Data model changes

None


Viewing all articles
Browse latest Browse all 300812

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>