Skip to content

About chained data persisters  #540

@sgomez

Description

@sgomez

In the documentation I can read this about DataPersisters:

Custom data persisters can be used to do so. A project can include as many data persisters as it needs. The first able to persist data for a given resource will be used.

However in ChainDataPersister class, persist and remove method executes all persisters than supports the entity:

    /**
     * {@inheritdoc}
     */
    public function persist($data)
    {
        foreach ($this->persisters as $persister) {
            if ($persister->supports($data)) {
                $data = $persister->persist($data) ?? $data;
            }
        }

        return $data;
    }

This could be a bug or the documentation is wrong?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions