orchidsoftware / orchidsoftware/platform

HasOne relationship generates a loop

Open
#1,836 1 comment 0 reactions 1 assignee View on GitHub

@tabuna is already working on this.

Since Aug 17, 2021.

Errors
Dominant language
PHP
Stars
4.8k
Forks
663
Avg merge
1d 9h
Merged PRs (30d)
7

Description

Describe the bug
When using the attachments with the hasOne relationship, I somehow generate a loop. As soon as I've remove the relationship the admin panel works again but I cannot retrieve the attachments anymore.

This only affects the "create" edit screen. If I edit an existing record, it works as usual.

To Reproduce
Steps to reproduce the behavior:

    public function hero()
    {
        return $this->hasOne(Attachment::class, foreignKey: 'id', localKey: 'hero')->withDefault();
    }

Expected behavior
It should be possible to use the hasOne relationship even without an existing record.

Screenshots
image
https://flareapp.io/share/Bm03adE5#F257

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Server (please complete the following information):

  • Platfrom Version: 10.12.2
  • Laravel Version: 8+
  • PHP Version: 8.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.