StatsFixture.php
2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace App\Test\Fixture;
use Cake\TestSuite\Fixture\TestFixture;
/**
* StatsFixture
*/
class StatsFixture extends TestFixture
{
// (EP) pour éviter d'avoir à décrire les champs
public $import = ['model' => 'Stats'];
/**
* Fields
*
* @var array
*/
/* (EP)
// @codingStandardsIgnoreStart
public $fields = [
'year' => ['type' => 'string', 'length' => null, 'null' => false, 'default' => null, 'collate' => null, 'comment' => '', 'precision' => null, 'fixed' => null],
'user_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
'last_login_time' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null],
'last_logout_time' => ['type' => 'datetime', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null],
'connex_nb' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => '0', 'comment' => 'nb connexions sur l\'année', 'precision' => null, 'autoIncrement' => null],
'connex_dur' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => '0', 'comment' => 'total temps connexion sur l\'année (sec)', 'precision' => null, 'autoIncrement' => null],
'_indexes' => [
'fk_stats_users' => ['type' => 'index', 'columns' => ['user_id'], 'length' => []],
'index_stats_year' => ['type' => 'index', 'columns' => ['year'], 'length' => []],
],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['year', 'user_id'], 'length' => []],
'fk_stats_users' => ['type' => 'foreign', 'columns' => ['user_id'], 'references' => ['users', 'id'], 'update' => 'restrict', 'delete' => 'cascade', 'length' => []],
],
'_options' => [
'engine' => 'InnoDB',
'collation' => 'latin1_swedish_ci'
],
];
*/
// @codingStandardsIgnoreEnd
/**
* Init method
*
* @return void
*/
public function init()
{
// (EP)
$this->records = [];
/*
$this->records = [
[
'year' => 'a4a821dd-3174-4fa5-9672-b2d5b3d9903c',
'user_id' => 1,
'last_login_time' => '2020-10-21 17:11:18',
'last_logout_time' => '2020-10-21 17:11:18',
'connex_nb' => 1,
'connex_dur' => 1
],
];
*/
parent::init();
}
}