- <?php
-
- namespace common\models;
-
- use Yii;
-
- /**
- * This is the model class for table "invoice".
- *
- * @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 Invoice extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'invoice';
- }
-
- /**
- * @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_invoice']);
- }
-
- /**
- * 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' => ''
- ] ;
- }
- }
|