Skip to content

best practice for deleting from m:belongsToMany #70

@achtan

Description

@achtan

Ahoj,

ako spravne managovat kolekcie v LM ?

/**
 * @property int $id
 * @property Bar[] $bars m:belongsToMany
 */
class Foo extends Entity
{

}


/**
 * @property int $id
 */
class Bar extends Entity
{

}

ked upravujem kolekciu:

$foo = $this->fooRepository->find($id);

$this->barRepository->deleteById($barId);

$bars = $foo->getBars();

na poslednom riadku to hodi vinimku:
Cannot get value of property 'bars' in entity Foo due to low-level failure: It is not allowed to create entity Bar from detached instance of LeanMapper\Row

priblizne chapem co sa tam deje, len by ma zaujimalo ako sa tomu vyhnut a ako riesit taketo situacie

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions