summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Persisters/Collection/CollectionPersister.php
blob: 07c4eaf9d42c31d10343393243ebd175882af57b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Persisters\Collection;

use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\PersistentCollection;

/**
 * Define the behavior that should be implemented by all collection persisters.
 */
interface CollectionPersister
{
    /**
     * Deletes the persistent state represented by the given collection.
     */
    public function delete(PersistentCollection $collection): void;

    /**
     * Updates the given collection, synchronizing its state with the database
     * by inserting, updating and deleting individual elements.
     */
    public function update(PersistentCollection $collection): void;

    /**
     * Counts the size of this persistent collection.
     */
    public function count(PersistentCollection $collection): int;

    /**
     * Slices elements.
     *
     * @return mixed[]
     */
    public function slice(PersistentCollection $collection, int $offset, int|null $length = null): array;

    /**
     * Checks for existence of an element.
     */
    public function contains(PersistentCollection $collection, object $element): bool;

    /**
     * Checks for existence of a key.
     */
    public function containsKey(PersistentCollection $collection, mixed $key): bool;

    /**
     * Gets an element by key.
     */
    public function get(PersistentCollection $collection, mixed $index): mixed;

    /**
     * Loads association entities matching the given Criteria object.
     *
     * @return mixed[]
     */
    public function loadCriteria(PersistentCollection $collection, Criteria $criteria): array;
}