Issue #2476059 by willzyx, tadityar, yarik.lutsiuk, Berdir: Remove EntityInterface->getSystemPath(), all its implementations and related usage
parent
99e0777322
commit
c31fec26b0
|
@ -392,13 +392,6 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface
|
|||
return parent::urlInfo($rel, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSystemPath($rel = 'edit-form') {
|
||||
return parent::getSystemPath($rel);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -216,16 +216,6 @@ abstract class Entity implements EntityInterface {
|
|||
return $uri->setOptions($uri_options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSystemPath($rel = 'canonical') {
|
||||
if ($this->hasLinkTemplate($rel) && $uri = $this->urlInfo($rel)) {
|
||||
return $uri->getInternalPath();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -161,23 +161,6 @@ interface EntityInterface extends AccessibleInterface, CacheableDependencyInterf
|
|||
*/
|
||||
public function link($text = NULL, $rel = 'canonical', array $options = []);
|
||||
|
||||
/**
|
||||
* Gets the internal path for this entity.
|
||||
*
|
||||
* self::url() will return the full path including any prefixes, fragments, or
|
||||
* query strings. This path does not include those.
|
||||
*
|
||||
* @param string $rel
|
||||
* The link relationship type, for example: canonical or edit-form.
|
||||
*
|
||||
* @return string
|
||||
* The internal path for this entity.
|
||||
*
|
||||
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.0. Use
|
||||
* static::urlInfo() instead.
|
||||
*/
|
||||
public function getSystemPath($rel = 'canonical');
|
||||
|
||||
/**
|
||||
* Indicates if a link template exists for a given key.
|
||||
*
|
||||
|
|
|
@ -138,12 +138,12 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
|
|||
*/
|
||||
protected function doTestAuthoringInfo() {
|
||||
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
|
||||
$path = $entity->getSystemPath('edit-form');
|
||||
$languages = $this->container->get('language_manager')->getLanguages();
|
||||
$values = array();
|
||||
|
||||
// Post different authoring information for each translation.
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
$url = $entity->urlInfo('edit-form', ['language' => $languages[$langcode]]);
|
||||
$user = $this->drupalCreateUser();
|
||||
$values[$langcode] = array(
|
||||
'uid' => $user->id(),
|
||||
|
@ -154,7 +154,7 @@ class CommentTranslationUITest extends ContentTranslationUITestBase {
|
|||
'date[date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'),
|
||||
'date[time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'),
|
||||
);
|
||||
$this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity, $langcode), array('language' => $languages[$langcode]));
|
||||
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode));
|
||||
}
|
||||
|
||||
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
|
||||
|
|
|
@ -996,13 +996,6 @@ class ViewUI implements ViewEntityInterface {
|
|||
return $this->storage->link($text, $rel, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSystemPath($rel = 'edit-form') {
|
||||
return $this->storage->getSystemPath($rel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\EntityInterface::label().
|
||||
*/
|
||||
|
|
|
@ -239,38 +239,6 @@ class EntityUrlTest extends UnitTestCase {
|
|||
$this->assertSame('http://drupal/entity/test_entity_type/test_entity_id', $valid_entity->url('canonical', array('absolute' => TRUE)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the getPathByAlias() method.
|
||||
*
|
||||
* @covers ::getSystemPath
|
||||
*/
|
||||
public function testGetSystemPath() {
|
||||
$entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
|
||||
$entity_type->expects($this->any())
|
||||
->method('getLinkTemplates')
|
||||
->will($this->returnValue(array(
|
||||
'canonical' => 'entity.test_entity_type.canonical',
|
||||
)));
|
||||
|
||||
$this->entityManager
|
||||
->expects($this->any())
|
||||
->method('getDefinition')
|
||||
->with('test_entity_type')
|
||||
->will($this->returnValue($entity_type));
|
||||
|
||||
$no_link_entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', array(array('id' => 'test_entity_id'), 'test_entity_type'));
|
||||
$this->assertSame('', $no_link_entity->getSystemPath('banana'));
|
||||
|
||||
$this->urlGenerator->expects($this->once())
|
||||
->method('getPathFromRoute')
|
||||
->with('entity.test_entity_type.canonical', array('test_entity_type' => 'test_entity_id'))
|
||||
->will($this->returnValue('entity/test_entity_type/test_entity_id'));
|
||||
|
||||
$valid_entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', array(array('id' => 'test_entity_id'), 'test_entity_type'));
|
||||
|
||||
$this->assertSame('entity/test_entity_type/test_entity_id', $valid_entity->getSystemPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the retrieval of link templates.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue