Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 如果在一个表里有多个 hasmany 的关联关系,无法获取正常的值 #360

Open
wwsheng009 opened this issue Apr 10, 2023 · 0 comments

Comments

@wwsheng009
Copy link
Contributor

发生了什么?

如果在一个表里有多个 hasmany 的关联关系,无法获取正常的值

相关截图(必需)

最小可复现例子(必需)

Please provide a minimal reproduction then upload to your GitHub. 请提供 最小重现,并上传到你的 GitHub 仓库

https://github.com/wwsheng009/yao-hasmany-unexpected

复现步骤

Steps to reproduce the behavior: 1. 2.

git clone https://github.com/wwsheng009/yao-hasmany-unexpected.git
cd yao-hasmany-unexpected
yao migrate --reset

yao run yao.table.get pet '::{"withs":{"dog":{}},"withs":{"cat":{"withs":{"whitecat":{}}}}}'
错误的结果如下:

--------------------------------------
yao.table.get 返回结果
--------------------------------------
[
    {
        "dogs": [
            {
                "id": 1,
                "name": "dog  one",
                "pet_id": 1
            },
            {
                "dogs": [
                    {
                        "id": 1,
                        "name": "cat  one",
                        "pet_id": 2
                    },
                    {
                        "id": 2,
                        "name": "cat  two",
                        "pet_id": 2
                    }
                ],
                "id": 2,
                "name": "dog  two",
                "pet_id": 1
            }
        ],
        "id": 1,
        "name": "dog number one"
    },
    {
        "id": 2,
        "name": "cat number two"
    }
]

Expected behavior 1. 2.

pets:
    - dogs
    - cats
        - whitecat

Context

https://github.com/wwsheng009/yao-hasmany-unexpected

  • Yao Version( Detail Version ):yao-0.10.3-pre
  • Xgen Version( Build Info ):
  • Platform:linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant