Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Fix SonataEnhancer #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ before_install:
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)

install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS
install: COMPOSER_MEMORY_LIMIT=-1 travis_wait composer update --prefer-dist $COMPOSER_FLAGS

script:
- if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi
Expand Down
6 changes: 4 additions & 2 deletions src/Description/SonataEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public function enhance(Description $description)
$admin->getIdParameter() => $admin->getUrlsafeIdentifier($object),
], true);

$linkKey = trim($code, '.)');
if (array_key_exists($linkKey, self::$linkKeyMapping)) {
$parts = explode('.', $code);
$linkKey = end($parts);

if (false !== $linkKey && array_key_exists($linkKey, self::$linkKeyMapping)) {
$description->set(self::$linkKeyMapping[$linkKey], $url);
}
}
Expand Down