Rol.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Rol".
  6. *
  7. * @property int $id
  8. * @property string|null $nombre
  9. * @property string|null $creado
  10. * @property string|null $modificado
  11. * @property string|null $eliminado
  12. *
  13. * @property Usuario[] $usuarios
  14. */
  15. class Rol extends \yii\db\ActiveRecord {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName() {
  20. return 'Rol';
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function rules() {
  26. return [
  27. [['creado', 'modificado', 'eliminado'], 'safe'],
  28. [['nombre'], 'string', 'max' => 255],
  29. ];
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function attributeLabels() {
  35. return [
  36. 'id' => 'ID',
  37. 'nombre' => 'Nombre',
  38. 'creado' => 'Creado',
  39. 'modificado' => 'Modificado',
  40. 'eliminado' => 'Eliminado',
  41. ];
  42. }
  43. /**
  44. * Gets query for [[Usuarios]].
  45. *
  46. * @return \yii\db\ActiveQuery
  47. */
  48. public function getUsuarios() {
  49. return $this->hasMany(Usuario::className(), ['idRol' => 'id']);
  50. }
  51. }