问题标签 [stofdoctrineextensions]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
tree - Gedmo Tree getPath 错误:节点与此存储库不相关 500 内部服务器错误 - InvalidArgumentException
我收到错误:
更新 1:无论我设置具有特征的树存储库还是扩展抽象存储库,错误都是一样的。
更新 2:完整堆栈跟踪http://pastebin.com/TtaJnyzf
我想从数据库中输出具有树结构的 html 树,特别是我需要获取从根到选定节点的路径。据我了解,这是通过 getPath() 函数完成的。
我在用:
- Symfony v3.0.6;
- 教义 v2.5.4
- StofDoctrineExtensionsBundle [1]
为了管理树结构。
为了设置树结构,我使用了 Symfony.com [2] 上的文档,然后是 GitHub [3]、[4]、[5]、[6] 上的文档。
到目前为止,我在数据库中有一个树结构,我得到了这样的 html 树:
我更改了两行以显示从树元素的根到所选项目的路径
如 [7] 和 [8] 中所见,存在应该将元素数组从根返回到所选项目的函数 getPath()。
我认为问题可能出在这个代码块上:
- [1] stofDoctrineExtensionsBundle在 GitHub 上;
- [2] stofDoctrineExtensinsBundle 文档;
- [3] Gedmo 树文档;
- [4] Gedmo 树 > 树实体示例;
- [5] Gedmo 树 > 基本使用示例;
- [6]树html输出示例;
- [7] NestedTreeRepository 使用NestedTreeRepositoryTrait
- [8] NestedTreeRepositoryTrait 具有函数“getPath()”。
请指教。感谢您的时间和知识。
php - 有多重关系的蛞蝓
我有三个实体,A
比如说B
和C
。A
拥有两个 ManyToOne 关系 toB
和 to C
。我想生成一个 slug A
,由 fieldA.a
和B.b
组成C.c
。A.a
目前,我可以使用and生成一个 slug B.b
,使用以下代码:
A类:
B类:
使用此代码,slugA.slug
类似于{{B.alias}}-{{A.name}}
. 我希望它是{{C.alias}}-{{B.alias}}-{{A.name}}
。我尝试SlugHander
在 的handlers
数组选项中添加另一个Gedmo\Slug
,但它忽略了第二个。我怎样才能做到这一点?
doctrine-orm - Doctrine 2 嵌套集 - 在单个查询中检索完整树
我正在使用stof/StofDoctrineExtensionsBundle(Atlantic18/DoctrineExtensions的捆绑包装器)来实现嵌套集(树)实体。该实体已配置并正在工作,但我无法弄清楚如何在单个查询中检索所有根注释及其所有子项(完整树)。我目前有完整的集合返回,但是它延迟加载所有子项,这意味着执行了大量查询。
谢谢你的帮助。
symfony - StofDoctrineExtensionsBundle 可上传
我使用 StofDoctrineExtensionsBundle Uploadable 在 User 实体中上传图片。
在控制器中:
在表单类型中:
配置.yml:
当我测试它时,我收到消息:
无法创建“/user”目录。
任何想法来解决这个问题。谢谢
symfony - 如何使用 symfony3、doctrine2 和 stofDoctrineExtensionsBundle 获取 Gedmo 树元素的ParentId
介绍
我正在使用 Symfony v3.1.6、Doctrine v2.5.4 和 StofDoctrineExtensionsBundle [1] 来管理树结构。
为了设置树结构,我使用了 Symfony.com [2] 上的文档,然后是 GitHub [3] 上的文档。然后我继续进行树设置 - 使用示例 [4] 中的树实体并使用 [5] 中的代码创建树。
- [1] stofDoctrineExtensionsBundle 在 GitHub 上;
- [2] Symfony.com 上的 stofDoctrineExtensinsBundnle 文档;
- [3] GitHub 上的 Gedmo 树文档;
- [4] Gedmo 树 > 树实体示例;
- [5] Gedmo 树 > 基本使用示例;
问题
我想处理parent_id
树的每个元素,但我不知道如何正确地做到这一点。
编码
控制器
构建树数据数组
当我转储时,$build_my_tree
我得到:
但我想得到以下信息:
那是parent_id
在每个树元素中。
结论
请指教。
感谢您的时间和知识。
symfony - Get parent_id of Gedmo Tree element using symfony3, doctrine2 and stofDoctrineExtensionsBundle
Introduction
I am using Symfony v3.1.6, Doctrine v2.5.4 and StofDoctrineExtensionsBundle [1] in order to manage Tree structure.
To setup Tree structure I used documentation on Symfony.com [2] followed by documentation on GitHub [3]. Then I proceeded with tree setup - used tree entity from example [4] and used code in [5] to create a tree.
- [1] stofDoctrineExtensionsBundle on GitHub;
- [2] stofDoctrineExtensinsBundnle documentation on Symfony.com;
- [3] Gedmo Tree documentation on GitHub;
- [4] Gedmo Tree > Tree Entity example;
- [5] Gedmo Tree > Basic Usage Example;
Code
Function in CategoryRepository
When I use $parent = $query->getResult()
I get following output:
but when I use $parent = $query->getArrayResult()
I get:
Note that there is no parent_id in the getArrayResult
output...
Question
So the question is - how can one get tree node parent_id
in the query result with getArrayResult
?
Conclusion
Please advise.
Thank you for your time and knowledge.
php - 更改位置超过 1 时,Doctrine Extensions Sortable 无法正常工作
我正在使用 Symfony 3.1 + Doctrine GEDMO 扩展(通过 StofDoctrineExtensionsBundle)。我已将我的实体设置为具有可排序行为:
当我继续将位置更改为一个时,排序行为正常:
但是当我实现了 JS 拖放来改变位置时,整个事情变得很奇怪。例如,有这个表:
当我为 id 6 的行执行此操作时:
表格更改为:
位置 1 没有任何内容,但位置 5 被占用两次。有任何想法吗?
php - 使用 symfony3、doctrine2 和 stofDoctrineExtensionsBundle 按任意字段对 Gedmo 树进行排序
介绍
我在用:
- 视窗 10 专业版
- XAMPP 与 PHP v7.0.9
- Symfony v3.1.7
- 教义 v2.5.4
- StofDoctrineExtensionsBundle [1]以管理树结构。
配置
为了设置树结构,我使用了 Symfony.com [2]上的文档,然后是 GitHub [3]上的文档。然后我继续进行树设置 - 使用示例[4]中的树实体并使用[5]中的代码创建树。
我确实设置了名为FileTree
. 我在树中添加了几个自定义字段item_name
:item_extension
和is_file
。title
像我一样被删除item_name
...
我的FileTree
实体:
问题
我需要按文件类型对树文件夹中的文件进行排序 - 即:按item_extension
然后按item_name
. 目前Gedmo Nestedset Tree
排序方式root
如下lft
一个代码块所示。
可悲的是,添加额外->orderBy('ft.item_extension', 'ASC')
的并没有产生任何结果......
然后我了解到[6]有 2 个功能可以帮助我完成这项工作reorderAll
,并且reorder
. 我尝试了他们两个,但遗憾的是项目没有改变它们的顺序,它们仍然由root
and订购lft
。
我的代码来自Upload Listener
:
或者
问题
如何获得一个包含按顺序排列的FileTree
项目的数组item_extension, item_name
?
我会对以太正确的 Doctrine 查询(最好)或解释包含函数reorder
和reorderAll
.
结论
我错过了什么?
请指教。
感谢您的时间和知识。