Passed
Pull Request — master (#49)
by
unknown
14:57
created

TagMapper::queueCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 8
rs 10
1
<?php
2
3
namespace App\Mapper;
4
5
use Cycle\Annotated\Annotation\Column;
6
use Cycle\Annotated\Annotation\Table;
7
use Cycle\ORM\Command\ContextCarrierInterface;
8
use Cycle\ORM\Command\CommandInterface;
9
use Cycle\ORM\Command\Database\Update;
10
use Cycle\ORM\Context\ConsumerInterface;
11
use Cycle\ORM\Heap\Node;
12
use Cycle\ORM\Heap\State;
13
use Cycle\ORM\Mapper\Mapper;
14
15
/**
16
 * @Table(
17
 *      columns={
18
 *          "created_at": @Column(type="datetime")
19
 *      }
20
 * )
21
 */
22
class TagMapper extends Mapper
23
{
24
    public function queueCreate($entity, Node $node, State $state): ContextCarrierInterface
25
    {
26
        $command = parent::queueCreate($entity, $node, $state);
27
28
        $state->register('created_at', new \DateTimeImmutable(), true);
29
        $command->register('created_at', new \DateTimeImmutable(), true);
30
31
        return $command;
32
    }
33
}
34