Passed
Push — master ( c12f94...3e1cf8 )
by Anton
03:42
created

RenderRelations::compute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
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\Generator;
11
12
use Cycle\Schema\Definition\Entity;
13
use Cycle\Schema\GeneratorInterface;
14
use Cycle\Schema\Registry;
15
16
/**
17
 * Renders all required relations columns, indexes and foreign keys.
18
 */
19
final class RenderRelations implements GeneratorInterface
20
{
21
    /**
22
     * @param Registry $registry
23
     * @param Entity   $entity
24
     */
25
    public function compute(Registry $registry, Entity $entity)
26
    {
27
        foreach ($registry->getRelations($entity) as $relation) {
28
            $relation->render($registry);
29
        }
30
    }
31
}