Skip to content

Multiple flushes do not behave as expected #28

@schettle

Description

@schettle
$dal = Container::make('dal.manager');

foreach (['a', 'b'] as $n) {
    foreach ([1, 2, 3, 4, 5] as $i) {
        $recipe = new Recipe();
        $recipe->setName($n . $i);

        $dal->persist($recipe);
        $dal->flush();
    }
}
$repository = $dal->getRepository('Graze\Lib\Entity\Product\Recipe');
dump($repository->findAll());

This inserts only b4 and b5, if I move the flush to after the for each loop, i.e. just one flush, it inserts all records as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions