|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
-
- namespace common\models;
-
- use Yii;
-
- /**
- * This is the model class for table "quotation".
- *
- * @property integer $id
- * @property string $name
- * @property string $reference
- * @property string $date
- * @property string $comment
- * @property integer $id_user
- * @property string $address
- * @property string $city
- * @property string $postcode
- */
- class Quotation extends ActiveRecordCommon
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'quotation';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['date'], 'safe'],
- [['comment', 'address'], 'string'],
- [['id_user'], 'integer'],
- [['name', 'reference', 'city', 'postcode'], 'string', 'max' => 255],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'name' => 'Nom',
- 'reference' => 'Référence',
- 'date' => 'Date',
- 'comment' => 'Commentaire',
- 'id_user' => 'Utilisateur',
- 'address' => 'Adresse',
- 'city' => 'Ville',
- 'postcode' => 'Code postale',
- ];
- }
-
- /*
- * Relations
- */
-
- public function getUser()
- {
- return $this->hasOne(User::className(), ['id' => 'id_user']);
- }
-
- public function getOrder()
- {
- return $this->hasOne(Order::className(), ['id' => 'id_quotation']);
- }
-
- /**
- * Retourne les options de base nécessaires à la fonction de recherche.
- *
- * @return array
- */
- public static function defaultOptionsSearch() {
- return [
- 'with' => [],
- 'join_with' => ['user', 'order'],
- 'orderby' => 'date ASC',
- 'attribute_id_producer' => ''
- ] ;
- }
- }
|