我正在尝试填充具有父子关系的对象,但是收到错误:
[Elastica\Exception\ResponseException] RoutingMissingException [[myindex]/[comment]/[12345]]需要路由
摘录类型conf:
article:
_source:
enabled: false
mappings:
...
comment:
_source:
enabled: false
_parent:
type: article
property: article_id
identifier: id
_routing:
required: true
path: article_id
mappings:
article:
type: long
index: not_analyzed
...
Run Code Online (Sandbox Code Playgroud)
不能理解我在这里失踪的东西....
我正在使用Symfony2.3,FOSElasticaBundle 3.0,ElasticSearch 1.2.2
我如何向所有现有的 Symfony3 类型添加自定义“帮助”选项?
在 Symfony2 中,我是这样做的http://toni.uebernickel.info/2012/11/03/how-to-extend-form-fields-in-symfony2.1.html但现在我要升级到 Symfony3 和它不再起作用 - 它给了我“帮助”选项不存在。
http://symfony.com/doc/current/form/form_customization.html#adding-help-messages可以使用,但需要将所有帮助文本移动到模板中:
{{ form_widget(form.title, {'help': 'foobar'}) }}
Run Code Online (Sandbox Code Playgroud)
...从类型类:
->add(
'periodFrom',
TextType::class,
[
'label' => 'period-from',
'required' => false,
'help' => 'period-from.help'
]
)
Run Code Online (Sandbox Code Playgroud)
我想避免这种情况。谢谢。
我有这个问题,我想创建“智能”标准。假设有一个模型为 1 Author : n Books。
所以,而不是:
$qb = $em->getRepository('Books')->createQueryBuilder('b')
->join('b.author', 'a')
->where('a.dod is null')
->where('a.name = :name')
->setParameter('name', 'Mozart');
;
Run Code Online (Sandbox Code Playgroud)
...我想做类似的事情:
$qb = $em->getRepository('Books')->createQueryBuilder('b')
->whereAuthorIsAlive()
->whereAuthorName('Mozart');
Run Code Online (Sandbox Code Playgroud)
我知道创建自定义 EntityManager 的可能性,但这还不够。自定义 QueryBuider 会更合适。