- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlPsiElementFactory.createFromText()
方法的一些代码示例,展示了YamlPsiElementFactory.createFromText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPsiElementFactory.createFromText()
方法的具体详情如下:
包路径:fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlPsiElementFactory
类名称:YamlPsiElementFactory
方法名:createFromText
暂无
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement psiElement1 = descriptor.getPsiElement();
YAMLKeyValue replacement = YamlPsiElementFactory.createFromText(
project,
YAMLKeyValue.class,
"class: " + replacementFQN
);
if (replacement != null && replacement.getValue() != null) {
psiElement1.replace(replacement.getValue());
}
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void insertYamlServiceTag() {
if(!(this.psiFile instanceof YAMLFile)) {
return;
}
String text = createServiceAsText(ServiceBuilder.OutputType.Yaml, this.psiFile);
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(project, YAMLKeyValue.class, text);
if(fromText == null) {
return;
}
PsiElement psiElement = YamlHelper.insertKeyIntoFile((YAMLFile) psiFile, fromText, "services");
if(psiElement != null) {
navigateToElement(new TextRange[] {psiElement.getTextRange()});
}
dispose();
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getYamlKeyValueAsString
*/
public void testGetYamlKeyValueAsString() {
String[] strings = {
"{ name: routing.loader, method: foo }",
"{ name: routing.loader, method: 'foo' }",
"{ name: routing.loader, method: \"foo\" }",
};
for (String s : strings) {
assertEquals("foo", YamlHelper.getYamlKeyValueAsString(
YamlPsiElementFactory.createFromText(getProject(), YAMLHashImpl.class, s),
"method"
));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getYamlArrayOnSequenceOrArrayElements
*/
public void testGetYamlArrayOnSequenceOrArrayElementsForArray() {
YAMLCompoundValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLCompoundValue.class, "" +
"calls: [@foo, @bar] \n"
);
assertNotNull(fromText);
String join = StringUtils.join(ContainerUtil.map(YamlHelper.getYamlArrayOnSequenceOrArrayElements(fromText), new Function<PsiElement, String>() {
@Override
public String fun(PsiElement psiElement) {
return psiElement.getText();
}
}), ",");
assertTrue(join.contains("foo"));
assertTrue(join.contains("bar"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#collectServiceTags
*/
public void testCollectServiceTags() {
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"foo:\n" +
" tags:\n" +
" - { name: routing.loader, method: crossHint }\n" +
" - { name: routing.loader1, method: crossHint }\n"
);
assertNotNull(fromText);
assertContainsElements(YamlHelper.collectServiceTags(fromText), "routing.loader", "routing.loader1");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
Collection<YAMLDocument> yamlDocuments = new ArrayList<YAMLDocument>();
yamlDocuments.add(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class, String.format(
"route1:\n" +
" path: /foo\n" +
)));
yamlDocuments.add(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class, String.format(
"route1:\n" +
" path: /foo\n" +
)));
yamlDocuments.add(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class, String.format(
"route1:\n" +
" pattern: /foo\n" +
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getYamlArrayOnSequenceOrArrayElements
*/
public void testGetYamlArrayOnSequenceOrArrayElements() {
String[] strings = {
"calls: [@foo, @bar] \n",
"calls:\n - @foo\n - @bar\n",
};
for (String s : strings) {
YAMLCompoundValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLCompoundValue.class, s);
assertNotNull(fromText);
List<PsiElement> elements = YamlHelper.getYamlArrayOnSequenceOrArrayElements(fromText);
assertNotNull(elements);
String join = StringUtils.join(ContainerUtil.map(elements, new Function<PsiElement, String>() {
@Override
public String fun(PsiElement psiElement) {
return psiElement.getText();
}
}), ",");
assertTrue(join.contains("foo"));
assertTrue(join.contains("bar"));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.routing.RouteHelper#getYamlRouteDefinitions
*/
public void testGetYamlRouteDefinitionsForControllerKeyword() {
Collection<StubIndexedRoute> yamlRouteDefinitions = RouteHelper.getYamlRouteDefinitions(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class,
"foo_keyword:\n" +
" path: /foo\n" +
" controller: 'AppBundle:Blog:list'\n"
));
StubIndexedRoute route = ContainerUtil.find(yamlRouteDefinitions, new MyEqualStubIndexedRouteCondition("foo_keyword"));
assertNotNull(route);
assertContainsElements(Collections.singletonList("AppBundle:Blog:list"), route.getController());
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#collectServiceTags
*/
public void testCollectServiceTagsForSymfony33TagsShortcutInline() {
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"foo:\n" +
" tags: [routing.loader_tags_3, routing.loader_tags_4]\n"
);
assertNotNull(fromText);
Set<String> collection = YamlHelper.collectServiceTags(fromText);
assertContainsElements(collection, "routing.loader_tags_3");
assertContainsElements(collection, "routing.loader_tags_4");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public void testYmlTagAttributeExtraction() {
YAMLHashImpl fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLHashImpl.class, "{ name: routing.loader, method: foo }");
YamlServiceTag tag = new YamlServiceTag("foo", "routing.loader", (YAMLMapping) fromText);
assertEquals("foo", tag.getAttribute("method"));
assertEquals("routing.loader", tag.getAttribute("name"));
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#collectServiceTags
*/
public void testCollectServiceTagsForSymfony33TagsShortcut() {
YAMLKeyValue fromText = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"foo:\n" +
" tags:\n" +
" - routing.loader_tags_1\n" +
" - routing.loader_tags_2\n"
);
assertNotNull(fromText);
Set<String> collection = YamlHelper.collectServiceTags(fromText);
assertContainsElements(collection, "routing.loader_tags_1");
assertContainsElements(collection, "routing.loader_tags_2");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#insertKeyIntoFile
*/
public void testInsertKeyValueWithMissingMainKeyInRoot() {
YAMLFile yamlFile = (YAMLFile) myFixture.configureByText(YAMLFileType.YML, "foo: foo");
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"my_service:\n" +
" class: foo\n" +
" tag: foo"
);
assertNotNull(yamlKeyValue);
YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");
assertEquals("" +
"foo: foo\n" +
"services:\n" +
" my_service:\n" +
" class: foo\n" +
" tag: foo",
yamlFile.getText()
);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.routing.RouteHelper#getYamlRouteDefinitions
*/
public void testGetYamlRouteDefinitionsWithMethods() {
Collection<StubIndexedRoute> yamlRouteDefinitions = RouteHelper.getYamlRouteDefinitions(YamlPsiElementFactory.createFromText(getProject(), YAMLDocument.class,
"route1:\n" +
" path: /foo\n" +
" methods: [GET]\n" +
"route2:\n" +
" path: /foo\n" +
" methods: GET\n" +
"route3:\n" +
" path: /foo\n" +
" methods: [GET, POST]\n"
));
assertContainsElements(Collections.singletonList("get"), ContainerUtil.find(yamlRouteDefinitions, new MyEqualStubIndexedRouteCondition("route1")).getMethods());
assertContainsElements(Collections.singletonList("get"), ContainerUtil.find(yamlRouteDefinitions, new MyEqualStubIndexedRouteCondition("route2")).getMethods());
assertContainsElements(Arrays.asList("get", "post"), ContainerUtil.find(yamlRouteDefinitions, new MyEqualStubIndexedRouteCondition("route3")).getMethods());
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#insertKeyIntoFile
*/
public void testInsertKeyWithArrayValue() {
YAMLFile yamlFile = (YAMLFile) myFixture.configureByText(YAMLFileType.YML, "" +
"services:\n" +
" foo:\n" +
" car: test"
);
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "" +
"my_service:\n" +
" class: foo\n" +
" tag:\n" +
" - foo\n"
);
assertNotNull(yamlKeyValue);
YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");
assertEquals("" +
"services:\n" +
" foo:\n" +
" car: test\n" +
" my_service:\n" +
" class: foo\n" +
" tag:\n" +
" - foo",
yamlFile.getText()
);
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinitionWithQuote() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - { name: 'kernel.event_listener', event: 'eventName', method: 'methodName' }\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem().getName());
assertEquals("eventName", visitor.getItem().getAttribute("event"));
assertEquals("methodName", visitor.getItem().getAttribute("method"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinitionForSymfony33TagsShortcut() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - kernel.event_listener\n" +
" - kernel.event_listener2\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem(0).getName());
assertEquals("kernel.event_listener", visitor.getItem(0).getAttribute("name"));
assertEquals("kernel.event_listener2", visitor.getItem(1).getName());
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinitionWithDoubleQuote() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - { name: \"kernel.event_listener\", event: \"eventName\", method: \"methodName\" }\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem().getName());
assertEquals("eventName", visitor.getItem().getAttribute("event"));
assertEquals("methodName", visitor.getItem().getAttribute("method"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinition() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - { name: kernel.event_listener, event: eventName, method: methodName }\n" +
" - { name: kernel.event_listener2, event: eventName2, method: methodName2 }\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem(0).getName());
assertEquals("eventName", visitor.getItem(0).getAttribute("event"));
assertEquals("methodName", visitor.getItem(0).getAttribute("method"));
assertEquals("kernel.event_listener2", visitor.getItem(1).getName());
assertEquals("eventName2", visitor.getItem(1).getAttribute("event"));
assertEquals("methodName2", visitor.getItem(1).getAttribute("method"));
}
我开始从事一个用 Symfony 2.8 编写的大型项目。将整个项目升级到 SF 3 需要数百小时,现在还不可能。我想到了一个想法,将 symfony/symfony 包解压到它替换的单个包中(com
我在提交表单后使用 FOSUserEvents,但订阅者调用了两次。 这样我的验证码第一次有效第二次无效 这是我的代码 router = $router; $this->request
我有以下路线: blog_show: path: /test/123 defaults: { _controller: TotalcanBravofillBundle:Te
我是测试新手。我想测试我的功能。我已经成功安装了 phpUnit。我在互联网上查看了许多教程。但我无法获得有关测试的正确信息。这是我的功能代码: public function loginAction
我正在尝试重现 facebook batch requests 的行为在他们的图形 api 上运行。 所以我认为最简单的解决方案是在 Controller 上向我的应用程序发出几个请求,例如: pub
在 Symfony Progress Bar documentation有一个超酷酒吧的示例图像。不幸的是,看起来文档的其余部分没有解释如何获得这样的结果。 这是图片,以防您错过: 我怎么才能得到它?
我使用Finder发送假脱机电子邮件,但是自动名称生成器将点放在文件名中,有时它们出现在文件的开头。 查找程序似乎无法获取具有该名称的文件-那些文件被隐藏了……有人经历过这种行为吗?有什么建议如何使用
我正在尝试进行 LDAP 身份验证,我目前遇到此类错误: ServiceNotFoundException: The service "security.firewall.map.context.ma
有没有办法验证和检查集合数组是否为空。我已经尝试过: /** * @Assert\NotBlank() * @Assert\Length( min = 1) */ protected $work
使用Smyfony2和Doctrin2,可以使用以下示例创建数据固定装置:http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/i
我看到在大多数Symfony 2示例中,例如,不存在记录时,Symfony 2会引发异常。我认为这种方法对最终用户不友好。为什么有人更喜欢引发异常而不在Flashbag上添加一些错误消息? 最佳答案
我对项目中的以下服务有疑问: app.security.guardAuthenticatorLoginPassword: class: AppBundle\Security\LoginPa
symfony缓存和登录Docker容器存在问题。 Web服务器从www-data用户和组执行,当我使用docker上安装的php从docker容器中清除symfony缓存时,它从root执行。 因此
我想了解 symfony 中的服务 我已阅读http://symfony.com/doc/2.3/book/service_container.html#creating-configuring-se
因为我对 Symfony 和 Doctrine 还很陌生,所以我有一个可能很愚蠢的问题;-) 有人可以用简单的词语向我解释集合(尤其是实体中的ArrayCollections)吗?它是什么以及何时以及
我收到了这个表格: {{ form_start(form) }} {{ form_end(form) }} 我想检查用户是否登录,我这样做了: {% if is_g
我的网站已准备好部署,我正在尝试将其设置为在线。 一些信息: 主持人是 OVH。 它不允许 SSH,我必须使用 FTP 发送文件。也没有命令行。 我现在希望能够在子目录中设置网站:/www/test(
过去几个月以来,我一直在尝试与symfony合作。昨晚我自动删除了不需要的存储库。之后,我无法使用symfony命令创建新的symfony项目。当我在终端中运行Symfony new Security
In the environnement variable, then in system variable, I edited the path and added在环境变量中,然后在系统变量
我们有一个 Symfony 1.4 应用程序,想升级到 Symfony 4。是否有可能或者我们必须重新编程该应用程序? 我们询问了我们附近的一家软件公司,他们告诉我们必须重新编写应用程序。 最佳答案
我是一名优秀的程序员,十分优秀!