|
- <?php
-
-
-
- namespace common\models;
-
- use Yii;
- use common\components\ActiveRecordCommon ;
- use common\models\DeveloppementPriorite;
-
-
- class Development extends ActiveRecordCommon
- {
- const STATUS_OPEN = 'open';
- const STATUS_CLOSED = 'closed';
-
- const TYPE_EVOLUTION = 'evolution';
- const TYPE_BUG = 'bug';
-
-
-
- public static function tableName()
- {
- return 'development';
- }
-
-
-
- public function rules()
- {
- return [
- [['subject', 'date'], 'required'],
- [['id', 'progress'], 'integer'],
- [['description'], 'string'],
- [['date', 'date_delivery'], 'safe'],
- [['time_estimate'], 'number'],
- [['subject', 'status', 'type'], 'string', 'max' => 255],
- ];
- }
-
-
-
-
- public function getDevelopmentPriority()
- {
- return $this->hasMany(
- DevelopmentPriority::className(),
- ['id_development' => 'id'])
- ->with('producer');
- }
-
- public function getDevelopmentPriorityCurrentProducer()
- {
- return $this->hasOne(
- DevelopmentPriority::className(),
- ['id_development' => 'id'])
- ->where(['id_producer' => Producer::getId()])
- ->with('producer');
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'subject' => 'Sujet',
- 'description' => 'Description',
- 'date' => 'Date',
- 'progress' => 'Avancement',
- 'status' => 'Statut',
- 'time_estimate' => 'Estimation temps',
- 'type' => 'Type',
- 'date_delivery' => 'Date de livraison'
- ];
- }
-
-
-
- public static function defaultOptionsSearch() {
- return [
- 'with' => ['developmentPriority', 'developmentPriorityCurrentProducer'],
- 'join_with' => [],
- 'orderby' => 'date DESC',
- 'attribute_id_producer' => ''
- ] ;
- }
-
-
-
- public function setDateDelivery($date = '')
- {
- if (strlen($date)) {
- $this->date_delivery = $date;
- }
-
- if (strlen($this->date_delivery)) {
- $this->date_delivery = date('Y-m-d', strtotime($this->date_delivery));
- }
- }
-
- }
|