我试图在symfony2中的每个字段之后添加一些帮助消息.
我在官方文档中读到了一个解决方案:http://symfony.com/doc/current/cookbook/form/form_customization.html#adding-help-messages
但是这个解决方案毫无意义,因为我们需要手动创建所有表单.例如,很容易定义标签:$formBuilder->add('myfieldname', 'text', array('label'=>'some my field label'));但如何传递帮助信息?(换句话说,一些自定义变量)
我用"git checkout -b mybranch"创建了分支.似乎出了点问题,现在我无法使用"git branch -D mybranch"删除它.它说:错误:没有找到分支'mybranch'.
让我们说我们有以下graphql架构:
type Author : Object {
id: ID!
name: String,
books: [Book]
}
type Book : Object {
id: ID!
title: String
authorId: Int
author: Author
}
Run Code Online (Sandbox Code Playgroud)
然后进行如下查询:
{
books: {
id
title
author { id name }
}
}
Run Code Online (Sandbox Code Playgroud)
例如,如果我们有10本书,那么我们将最终得到10个作者查询,因为将为每个获取的书调用resolve函数:
select id, name from author where id = 123
Run Code Online (Sandbox Code Playgroud)
除此之外,我们可以将所有作者查询作为单个查询执行:
select id, name from author where id in (123, 456, 789, 1011)
Run Code Online (Sandbox Code Playgroud)
是否有一些工作解决方案,最佳实践,技术或某些有助于实现这一目标的东西?
我正在使用Symfony 2安全系统.
当某些用户尝试登录时,我还要检查用户的字段"已激活"是否为真.如果没有,则会显示错误消息:"您必须先激活您的帐户".
我该如何实现此功能?
我有'形状'索引,存储了许多巨大的地理形状(一个地理形状的原始shapefile大小为6MB).
我正在使用这个映射:
"shape": {
"type": "geo_shape",
"tree": "quadtree",
"tree_levels": "20"
},
"_all": {
"enabled": false
},
"dynamic": "true"
Run Code Online (Sandbox Code Playgroud)
我也有'照片'索引.每张照片的纬度和经度都显示为带有Point类型的地理位置.例如
"location": {
"type": "Point",
"coordinates": [
-103.262600,
43.685315
]
}
Run Code Online (Sandbox Code Playgroud)
映射:
"location": {
"type": "geo_shape",
"tree": "quadtree",
"tree_levels": 20
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用以下查询查找位于所选形状内的所有照片:
GET photos/_search
{
"query": {
"filtered": {
"filter": {
"geo_shape": {
"location": {
"relation": "intersects",
"indexed_shape": {
"id": "huge_region_shape_id",
"type": "country",
"index": "shapes",
"path": "shape"
}
}
}
},
"query": {
"match_all": {}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题:
1)在巨大的形状上,这个查询会执行几分钟或永久.
2)只是通过某些参数搜索形状需要花费大量时间,如果"形状"包含在源中,但如果我将其排除 …
通过使用graphql-js,我需要通过迭代某些数据的数组来动态创建graphql模式,例如:
[{
name: 'author',
fields: [{
field: 'name'
}, {
field: 'books',
reference: 'book'
}]
}, {
name: 'book',
fields: [{
field: 'title'
}, {
field: 'author',
reference: 'author'
}]
}]
Run Code Online (Sandbox Code Playgroud)
问题是循环引用.当我创建AuthorType时,我需要创建BookType,反之亦然.
因此生成的模式应如下所示:
type Author : Object {
id: ID!
name: String,
books: [Book]
}
type Book : Object {
id: ID!
title: String
author: Author
}
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?