gpt4 book ai didi

orm - 学说2 : Applying a filter to an association

转载 作者:行者123 更新时间:2023-12-04 17:38:15 25 4
gpt4 key购买 nike

例如,如果我有:

class Parent {

/* ... */

/** One to Many association */
protected $children;

}

class Child
{
/* .. */
/** many to one association */
protected $parent;

/* name of child column */
protected $name;
}

现在,假设对于 parent ,我想按 child 的名字过滤 child 。如果可能,以某种方式使用此过滤器执行 parent.getChildren() 会很好,但这是不可能的。

我希望它可能具有 getChildrenByName() 语法,但此函数似乎不适合 ORM 类及其存储库类。有没有人有什么建议?

最佳答案

此功能允许您在获取关联时添加条件:

使用关联:过滤集合

  • Version 3.0
  • Version 2.7
  • 关于orm - 学说2 : Applying a filter to an association,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11400634/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com