Browse Source

Refactoring/traduction modèle Developpement > Development

dev
Guillaume Bourgeois 6 years ago
parent
commit
450a1f8f36
1 changed files with 41 additions and 32 deletions
  1. +41
    -32
      common/models/Development.php

common/models/Developpement.php → common/models/Development.php View File

* This is the model class for table "developpement". * This is the model class for table "developpement".
* *
* @property integer $id * @property integer $id
* @property string $objet
* @property string $subject
* @property string $description * @property string $description
* @property string $date * @property string $date
* @property integer $avancement
* @property string $statut
* @property double $estimation_temps
* @property integer $progress
* @property string $status
* @property double $time_estimate
*/ */
class Developpement extends \yii\db\ActiveRecord
class Development extends \yii\db\ActiveRecord
{ {
const STATUT_OPEN = 'open';
const STATUT_CLOSED = 'closed';
const TYPE_EVOLUTION = 'evolution';
const TYPE_BUG = 'bug';
const STATUS_OPEN = 'open';
const STATUS_CLOSED = 'closed';
const TYPE_EVOLUTION = 'evolution';
const TYPE_BUG = 'bug';


/** /**
* @inheritdoc * @inheritdoc
*/ */
public static function tableName() public static function tableName()
{ {
return 'developpement';
return 'development';
} }


/** /**
public function rules() public function rules()
{ {
return [ return [
[['objet', 'date'], 'required'],
[['id', 'avancement'], 'integer'],
[['subject', 'date'], 'required'],
[['id', 'progress'], 'integer'],
[['description'], 'string'], [['description'], 'string'],
[['date', 'date_livraison'], 'safe'],
[['estimation_temps'], 'number'],
[['objet', 'statut', 'type'], 'string', 'max' => 255],
[['date', 'date_delivery'], 'safe'],
[['tie_estimate'], 'number'],
[['objet', 'status', 'type'], 'string', 'max' => 255],
]; ];
} }


* Relations * Relations
*/ */
public function getDeveloppementPriorite()
public function getDevelopmentPriority()
{ {
return $this->hasMany(DeveloppementPriorite::className(), ['id_developpement' => 'id'])->with('etablissement');
return $this->hasMany(
DevelopmentPriority::className(),
['id_development' => 'id'])
->with('producer');
} }


public function getDeveloppementPrioriteCurrentEtablissement()
public function getDevelopmentPriorityCurrentProducer()
{ {
return $this->hasOne(DeveloppementPriorite::className(), ['id_developpement' => 'id'])->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement])->with('etablissement');
return $this->hasOne(
DevelopmentPriority::className(),
['id_development' => 'id'])
->where(['id_producer' => Producer::getCurrent()])
->with('producer');
} }


/** /**
{ {
return [ return [
'id' => 'ID', 'id' => 'ID',
'objet' => 'Sujet',
'subject' => 'Sujet',
'description' => 'Description', 'description' => 'Description',
'date' => 'Date', 'date' => 'Date',
'avancement' => 'Avancement',
'statut' => 'Statut',
'estimation_temps' => 'Estimation temps',
'progress' => 'Avancement',
'status' => 'Statut',
'time_estimate' => 'Estimation temps',
'type' => 'Type', 'type' => 'Type',
'date_livraison' => 'Date de livraison'
'date_delivery' => 'Date de livraison'
]; ];
} }
* *
* @param string $date * @param string $date
*/ */
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));
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));
}
} }


} }

Loading…
Cancel
Save