SchemaBuilder::userTable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 22
ccs 19
cts 19
cp 1
crap 1
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the FOS User Util package.
5
 *
6
 * (c) Jean-Bernard Addor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FosUserUtil\Doctrine\DBAL;
13
14
use Doctrine\DBAL\Schema\Schema;
15
16
class SchemaBuilder
17
{
18
    protected $schema;
19
20 2
    public function __construct(Schema $schema)
21
    {
22 2
        $this->schema = $schema;
23 2
    }
24
25 1
    public function userTable()
26
    {
27 1
        $UserTable = $this->schema->createTable('http_user');
28 1
        $UserTable->addColumn('uuid', 'guid');
29 1
        $UserTable->setPrimaryKey(['uuid']);
30 1
        $UserTable->addColumn('username', 'string', ['length' => 180]);
31 1
        $UserTable->addColumn('username_canonical', 'string', ['length' => 180]);
32 1
        $UserTable->addUniqueIndex(['username_canonical'], 'username_canonical_unique_index'); // name probably not needed
33 1
        $UserTable->addColumn('email', 'string', ['length' => 180]);
34 1
        $UserTable->addColumn('email_canonical', 'string', ['length' => 180]);
35 1
        $UserTable->addUniqueIndex(['email_canonical'], 'email_canonical_unique_index'); // name probably not needed
36 1
        $UserTable->addColumn('enabled', 'boolean');
37 1
        $UserTable->addColumn('salt', 'string', ['notnull' => false]); // 'length' => 255
38 1
        $UserTable->addColumn('password', 'string'); // 'length' => 255
39 1
        $UserTable->addColumn('last_login', 'datetime', ['notnull' => false]);
40 1
        $UserTable->addColumn('confirmation_token', 'string', ['length' => 180, 'notnull' => false]);
41 1
        $UserTable->addUniqueIndex(['confirmation_token'], 'confirmation_token_unique_index'); // name probably not needed
42 1
        $UserTable->addColumn('password_requested_at', 'datetime', ['notnull' => false]);
43 1
        $UserTable->addColumn('roles', 'array');
44
45 1
        return $UserTable;
46
    }
47
}
48
49
// https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/config/doctrine-mapping/User.orm.xml
50