Completed
Push — 2.x ( 35bfbf...a6463c )
by Aleksei
17s queued 15s
created

NullHeap::detach()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\ORM\Heap;
6
7
/**
8
 * NullHeap is a heap implementation that does nothing.
9
 * It is useful when you are using ORM only for reading and you don't need to cache the loaded data.
10
 *
11
 * Effects of using NullHeap:
12
 * - Less memory consumption
13
 * - No need to clean the heap after each request in long-living applications
14
 * - You won't be able to update entities in the database. ORM will consider each loaded entity as newly created.
15
 */
16
final class NullHeap implements HeapInterface
17
{
18
    public function has(object $entity): bool
19
    {
20
        return false;
21
    }
22
23
    public function get(object $entity): ?Node
24
    {
25
        return null;
26
    }
27
28
    public function find(string $role, array $scope): ?object
29
    {
30
        return null;
31
    }
32
33
    public function attach(object $entity, Node $node, array $index = []): void
34
    {
35
    }
36
37
    public function detach(object $entity): void
38
    {
39
    }
40
41
    public function clean(): void
42
    {
43
    }
44
}
45