* defaults: { _controller: "Bundle:Foo:Bar" }
* defaults:
* _controller: "Bundle:Foo:Bar"
*/
if(psiElement instanceof YAMLKeyValue && psiElement.getParent() instanceof YAMLDocument) {
YAMLKeyValue yamlKeyValue = YamlHelper.getYamlKeyValue((YAMLKeyValue) psiElement, "defaults");
if(yamlKeyValue != null) {
YAMLCompoundValue yamlCompoundValue = PsiTreeUtil.getChildOfType(yamlKeyValue, YAMLCompoundValue.class);
if(yamlCompoundValue != null) {
// if we have a child of YAMLKeyValue, we need to go back to parent
// else on YAMLHash we can directly visit array keys
PsiElement yamlHashElement = PsiTreeUtil.getChildOfAnyType(yamlCompoundValue, YAMLHash.class, YAMLKeyValue.class);
if(yamlHashElement instanceof YAMLKeyValue) {
yamlHashElement = yamlCompoundValue;
}
if(yamlHashElement != null) {
YAMLKeyValue yamlKeyValueController = YamlHelper.getYamlKeyValue(yamlHashElement, "_controller", true);
if(yamlKeyValueController != null) {
Method method = ControllerIndex.getControllerMethod(psiElement.getProject(), yamlKeyValueController.getValueText());
if(method != null) {
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.TWIG_CONTROLLER_LINE_MARKER).
setTargets(method).
setTooltipText("Navigate to action");