- <?php
-
- namespace common\models;
-
- use Yii;
- use common\models\DeveloppementPriorite;
-
- /**
- * 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],
- ];
- }
-
- public function getDeveloppementPriorite() {
- return $this->hasMany(DeveloppementPriorite::className(), ['id_developpement' => 'id'])->with('etablissement');
- }
-
- public function getDeveloppementPrioriteCurrentEtablissement() {
- return $this->hasOne(DeveloppementPriorite::className(), ['id_developpement' => 'id'])->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement])->with('etablissement');
- }
-
- /**
- * @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'
- ];
- }
-
- public function setDateLivraison($date = '') {
-
- if (strlen($date))
- $this->date_livraison = $date;
-
- if (strlen($this->date_livraison))
- $this->date_livraison = date('Y-m-d', strtotime($this->date_livraison));
- }
-
- }
|