DatabaseFacade::generateConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Database\Business;
5
6
use Xervice\Core\Business\Model\Facade\AbstractFacade;
7
8
/**
9
 * @method \Xervice\Database\Business\DatabaseBusinessFactory getFactory()
10
 * @method \Xervice\Database\DatabaseConfig getConfig()
11
 */
12
class DatabaseFacade extends AbstractFacade
13
{
14
    /**
15
     * Initialize Propel database connection
16
     *
17
     * @api
18
     */
19 1
    public function initDatabase(): void
20
    {
21 1
        $this->getFactory()->createPropelProvider()->init();
22 1
    }
23
24
    /**git tag
25
     * Generate propel config from project config
26
     *
27
     * @api
28
     */
29 1
    public function generateConfig(): void
30
    {
31 1
        $this->getFactory()->createConfigGenerator()->generate();
32 1
    }
33
34
    /**
35
     * Build all models
36
     *
37
     * @api
38
     *
39
     * @return array
40
     */
41 1
    public function buildModel(): array
42
    {
43 1
        return $this->getFactory()->createBuildModel()->buildModel();
44
    }
45
46
    /**
47
     * Runs all migrations
48
     *
49
     * @api
50
     *
51
     * @return array
52
     */
53 1
    public function migrate(): array
54
    {
55 1
        $result = $this->getFactory()->createPropelCommandProvider()->execute('migration:diff');
56 1
        return array_merge(
57 1
            $result,
58 1
            $this->getFactory()->createPropelCommandProvider()->execute('migration:migrate')
59
        );
60
    }
61
}
62