Skip to content

Commit

Permalink
Merge pull request #8 from interactive-solutions/allow-aliases-in-ids
Browse files Browse the repository at this point in the history
Allow the use of aliases in all steps that use createUri
  • Loading branch information
noggan authored Jan 3, 2017
2 parents 3c34788 + e4510f7 commit 9dd8bc6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Context/ApiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ private function convertValueToAlias($value)
return $this->replaceValueWithAlias($value);
}

/**
* @param $value
* @return string|mixed
*/
private function replaceValueWithAlias($value)
{
if (!(strpos($value, '%') === 0) && !(strpos(strrev($value), '%') === 0)) {
Expand Down Expand Up @@ -731,9 +735,10 @@ private function sendRpcAction($uri, $method, array $body = [])
*/
private function createUri($type, $typeId = null, $subType = null, $subTypeId = null)
{
$uri = '/';

$route = $this->entityFixtureContext->getEntityRoute($type);
$uri = '/';
$route = $this->entityFixtureContext->getEntityRoute($type);
$typeId = $this->replaceValueWithAlias($typeId);
$subTypeId = $this->replaceValueWithAlias($subTypeId);

if (!$route) {
$route = PluralisationUtil::pluralize($type);
Expand Down

0 comments on commit 9dd8bc6

Please sign in to comment.