Passed
Push — master ( 9bffc1...46953a )
by Anton
01:43
created

HasOne::compute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
namespace Cycle\Schema\Relation;
11
12
use Cycle\ORM\Relation;
13
14
class HasOne extends AbstractSchema
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    protected const OPTION_SCHEMA = [
20
        // save with parent
21
        Relation::CASCADE   => true,
22
23
        // not nullable by default
24
        Relation::NULLABLE  => false,
25
26
        // use outer entity constrain by default
27
        Relation::CONSTRAIN => true,
28
29
        // link to parent entity primary key by default
30
        Relation::INNER_KEY => '{source:primaryKey}',
31
32
        // default field name for inner key
33
        Relation::OUTER_KEY => '{source:role}_{innerKey}',
34
    ];
35
}