Test Failed
Push — master ( 746959...40ea1f )
by Petr
03:17
created

ComposerScripter::createDatabase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
c 1
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AppBundle\Command\Composer;
4
5
use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler;
6
use Composer\Script\Event;
7
8
/**
9
 * @author Vehsamrak
10
 */
11
class ComposerScripter extends ScriptHandler
12
{
13
14
    /**
15
     * Clears the Symfony cache.
16
     */
17
    public static function loadFixtures(Event $event)
18
    {
19
        $consoleDir = static::getConsoleDir($event, 'Load fixtures to database');
20
21
        static::executeCommand($event, $consoleDir, 'rock:fixture:load');
22
    }
23
24
    /**
25
     * Creating database
26
     */
27
    public static function createDatabase(Event $event)
28
    {
29
        $consoleDir = static::getConsoleDir($event, 'Creates the configured database');
30
31
        static::executeCommand($event, $consoleDir, 'doctrine:database:create --if-not-exists');
32
    }
33
34
    /**
35
     * Update database schema
36
     */
37
    public static function updateDatabaseSchema(Event $event)
38
    {
39
        $consoleDir = static::getConsoleDir($event, 'Creates the configured database');
40
41
        static::executeCommand($event, $consoleDir, 'doctrine:schema:update --force');
42
    }
43
}
44