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

🐛 load null relation with Embeddable #422

Closed
1 task done
gam6itko opened this issue Jul 6, 2023 · 0 comments · Fixed by #423
Closed
1 task done

🐛 load null relation with Embeddable #422

gam6itko opened this issue Jul 6, 2023 · 0 comments · Fixed by #423
Assignees
Labels
Milestone

Comments

@gam6itko
Copy link
Contributor

gam6itko commented Jul 6, 2023

No duplicates 🥲.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

If i load null relation entity with Embeddable the error occurs.

[TypeError]
Cycle\ORM\Parser\MultiKeyCollection::getLastItemKeys(): Return value must be of type array, null returned in vendor/cycle/orm/src/Parser/MultiKeyCollection.php:65

Example classes

class User
{
    #[Cycle\Relation\HasOne(target: Billing::class, outerKey: 'user_id', nullable: true)]
    private ?Billing $billing = null;
}
class Billing
{
    #[Cycle\Relation\Embedded(target: SomeEmbedded::class)]
    private SomeEmbedded $someEmbedded;
}
#[Cycle\Embeddable(columnPrefix: 'foo_')]
class SomeEmbedded
{
    #[Cycle\Column(type: 'decimal(12,2)', default: 0)]
    public float $propertyDecimal = 0;

    #[Cycle\Column(type: 'integer', default: 0)]
    public int $propertyInt = 0;
}

// reproduce bug

$this->gerRepository(User::class)
    ->select()
    ->load('billing')
    ->where('id', $someId)
    ->fetchData();

Version

ORM 2.3.2
PHP 8.1
@gam6itko gam6itko added status:to be verified Needs to be reproduced and validated. type:bug Bug labels Jul 6, 2023
@roxblnfk roxblnfk linked a pull request Jul 6, 2023 that will close this issue
@roxblnfk roxblnfk removed the status:to be verified Needs to be reproduced and validated. label Jul 6, 2023
@roxblnfk roxblnfk added this to the 2.3.x milestone Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants