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.prodstable
<?php | |||||
namespace app\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 { | |||||
/** | |||||
* @inheritdoc | |||||
*/ | |||||
public static function tableName() { | |||||
return 'developpement'; | |||||
} | |||||
/** | |||||
* @inheritdoc | |||||
*/ | |||||
public function rules() { | |||||
return [ | |||||
[['id', 'objet', 'date'], 'required'], | |||||
[['id', 'avancement'], 'integer'], | |||||
[['description'], 'string'], | |||||
[['date'], 'safe'], | |||||
[['estimation_temps'], 'number'], | |||||
[['objet', 'statut'], 'string', 'max' => 255], | |||||
]; | |||||
} | |||||
/** | |||||
* @inheritdoc | |||||
*/ | |||||
public function attributeLabels() { | |||||
return [ | |||||
'id' => 'ID', | |||||
'objet' => 'Objet', | |||||
'description' => 'Description', | |||||
'date' => 'Date', | |||||
'avancement' => 'Avancement', | |||||
'statut' => 'Statut', | |||||
'estimation_temps' => 'Estimation temps', | |||||
]; | |||||
} | |||||
} |
<?php | |||||
namespace app\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', | |||||
]; | |||||
} | |||||
} |
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
class m171226_200642_tables_developpement extends Migration { | |||||
public function up() { | |||||
$this->createTable('developpement', [ | |||||
'id' => Schema::TYPE_INTEGER . ' NOT NULL', | |||||
'objet' => Schema::TYPE_STRING . ' NOT NULL', | |||||
'description' => Schema::TYPE_TEXT, | |||||
'date' => Schema::TYPE_DATE . ' NOT NULL', | |||||
'avancement' => Schema::TYPE_INTEGER . ' DEFAULT 0', | |||||
'statut' => Schema::TYPE_STRING . ' DEFAULT \'open\'', | |||||
'estimation_temps' => Schema::TYPE_FLOAT, | |||||
]); | |||||
$this->createTable('developpement_priorite', [ | |||||
'id_user' => Schema::TYPE_INTEGER . ' NOT NULL', | |||||
'id_developpement' => Schema::TYPE_INTEGER . ' NOT NULL', | |||||
]); | |||||
} | |||||
public function down() { | |||||
$this->dropTable('developpement') ; | |||||
$this->dropTable('developpement_priorite') ; | |||||
} | |||||
} |