Преглед изворни кода

Refactoring/traduction modèle Developpement > Development

dev
Guillaume Bourgeois пре 6 година
родитељ
комит
450a1f8f36
1 измењених фајлова са 41 додато и 32 уклоњено
  1. +41
    -32
      common/models/Development.php

common/models/Developpement.php → common/models/Development.php Прегледај датотеку

@@ -45,27 +45,27 @@ use common\models\DeveloppementPriorite;
* This is the model class for table "developpement".
*
* @property integer $id
* @property string $objet
* @property string $subject
* @property string $description
* @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
*/
public static function tableName()
{
return 'developpement';
return 'development';
}

/**
@@ -74,12 +74,12 @@ class Developpement extends \yii\db\ActiveRecord
public function rules()
{
return [
[['objet', 'date'], 'required'],
[['id', 'avancement'], 'integer'],
[['subject', 'date'], 'required'],
[['id', 'progress'], 'integer'],
[['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],
];
}

@@ -87,14 +87,21 @@ class Developpement extends \yii\db\ActiveRecord
* 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');
}

/**
@@ -104,14 +111,14 @@ class Developpement extends \yii\db\ActiveRecord
{
return [
'id' => 'ID',
'objet' => 'Sujet',
'subject' => 'Sujet',
'description' => 'Description',
'date' => 'Date',
'avancement' => 'Avancement',
'statut' => 'Statut',
'estimation_temps' => 'Estimation temps',
'progress' => 'Avancement',
'status' => 'Statut',
'time_estimate' => 'Estimation temps',
'type' => 'Type',
'date_livraison' => 'Date de livraison'
'date_delivery' => 'Date de livraison'
];
}
@@ -120,13 +127,15 @@ class Developpement extends \yii\db\ActiveRecord
*
* @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…
Откажи
Сачувај