Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace common\models;
- use Yii;
- /**
- * This is the model class for table "post".
- *
- * @property string $id_post
- * @property string $id_categoryFK
- * @property string $id_user
- * @property string $content
- * @property string $Create_at
- *
- * @property Category $idCategoryFK
- * @property User $idUser
- */
- class Post extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'post';
- }
- public function beforeValidate()
- {
- }
- public function rules()
- {
- return [
- [['id_categoryFK', 'id_user'], 'integer'],
- [['content', 'Create_at'], 'required'],
- [['Create_at'], 'safe'],
- [['content'], 'string', 'max' => 1000],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id_post' => 'Id Post',
- 'id_categoryFK' => 'Category',
- 'id_user' => 'User',
- 'content' => 'Content',
- 'Create_at' => 'Create At',
- ];
- }
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getIdCategoryFK()
- {
- return $this->hasOne(Category::className(), ['id_category' => 'id_categoryFK']);
- }
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getIdUser()
- {
- return $this->hasOne(User::className(), ['id' => 'id_user']);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement