Création des tables et des modèles pour la section développement de l'administration. Cette section regroupe les développements en cours pour la plateforme et sont visibles aux producteurs. Ces derniers peuvent définir leur priorités. Ajout du champs 'type'. Ajout des constantes dans Developpement pour 'statut' et 'type' Ajout de la date de livraisonprodstable
@@ -0,0 +1,64 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "developpement". | |||
* | |||
* @property integer $id | |||
* @property string $objet | |||
* @property string $description | |||
* @property string $date | |||
* @property integer $avancement | |||
* @property string $statut | |||
* @property double $estimation_temps | |||
*/ | |||
class Developpement extends \yii\db\ActiveRecord { | |||
const STATUT_OPEN = 'open' ; | |||
const STATUT_CLOSED = 'closed' ; | |||
const TYPE_EVOLUTION = 'evolution' ; | |||
const TYPE_BUG = 'bug' ; | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() { | |||
return 'developpement'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() { | |||
return [ | |||
[['objet', 'date'], 'required'], | |||
[['id', 'avancement'], 'integer'], | |||
[['description'], 'string'], | |||
[['date','date_livraison'], 'safe'], | |||
[['estimation_temps'], 'number'], | |||
[['objet', 'statut','type'], 'string', 'max' => 255], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() { | |||
return [ | |||
'id' => 'ID', | |||
'objet' => 'Sujet', | |||
'description' => 'Description', | |||
'date' => 'Date', | |||
'avancement' => 'Avancement', | |||
'statut' => 'Statut', | |||
'estimation_temps' => 'Estimation temps', | |||
'type' => 'Type', | |||
'date_livraison' => 'Date de livraison' | |||
]; | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
<?php | |||
namespace common\models; | |||
use Yii; | |||
/** | |||
* This is the model class for table "developpement_priorite". | |||
* | |||
* @property integer $id_user | |||
* @property integer $id_developpement | |||
*/ | |||
class DeveloppementPriorite extends \yii\db\ActiveRecord { | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public static function tableName() { | |||
return 'developpement_priorite'; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function rules() { | |||
return [ | |||
[['id_user', 'id_developpement'], 'required'], | |||
[['id_user', 'id_developpement'], 'integer'], | |||
]; | |||
} | |||
/** | |||
* @inheritdoc | |||
*/ | |||
public function attributeLabels() { | |||
return [ | |||
'id_user' => 'Id User', | |||
'id_developpement' => 'Id Developpement', | |||
]; | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
class m171226_200642_tables_developpement extends Migration { | |||
public function up() { | |||
$this->createTable('developpement', [ | |||
'id' => 'pk', | |||
'objet' => Schema::TYPE_STRING . ' NOT NULL', | |||
'description' => Schema::TYPE_TEXT, | |||
'date' => Schema::TYPE_DATETIME . ' NOT NULL', | |||
'avancement' => Schema::TYPE_INTEGER . ' DEFAULT 0', | |||
'statut' => Schema::TYPE_STRING . ' DEFAULT \'open\'', | |||
'type' => Schema::TYPE_STRING . ' DEFAULT \'evolution\'', | |||
'estimation_temps' => Schema::TYPE_FLOAT, | |||
'date_livraison' => Schema::TYPE_DATE | |||
]); | |||
$this->createTable('developpement_priorite', [ | |||
'id_user' => Schema::TYPE_INTEGER . ' NOT NULL', | |||
'id_developpement' => Schema::TYPE_INTEGER . ' NOT NULL', | |||
'PRIMARY KEY (`id_user`, `id_developpement`)' | |||
]); | |||
} | |||
public function down() { | |||
$this->dropTable('developpement') ; | |||
$this->dropTable('developpement_priorite') ; | |||
} | |||
} |