1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "Producto".
- *
- * @property string $id
- * @property string|null $nombre
- * @property string|null $idPadre
- * @property string|null $creado
- * @property string|null $modificado
- * @property string|null $eliminado
- * @property int|null $idSagarhpa
- *
- * @property Producto $idPadre
- * @property Producto[] $productos
- */
- class Producto extends ModeloBase {
- /**
- * {@inheritdoc}
- */
- public static function tableName() {
- return 'Producto';
- }
- /**
- * {@inheritdoc}
- */
- public function rules() {
- return [
- [['id'], 'required'],
- [['creado', 'modificado', 'eliminado'], 'safe'],
- [['id', 'idPadre'], 'string', 'max' => 36],
- [['nombre'], 'string', 'max' => 100],
- [['idSagarhpa'], 'integer'],
- [['id'], 'unique'],
- [['idPadre'], 'exist', 'skipOnError' => true, 'targetClass' => Producto::class, 'targetAttribute' => ['idPadre' => 'id']],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels() {
- return [
- 'id' => 'ID',
- 'nombre' => 'Nombre',
- 'idPadre' => 'Id Padre',
- 'creado' => 'Creado',
- 'idSagarhpa' => 'idSagarhpa',
- 'modificado' => 'Modificado',
- 'eliminado' => 'Eliminado',
- ];
- }
- /**
- * Gets query for [[IdPadre]].
- *
- * @return \yii\db\ActiveQuery
- */
- public function getIdPadre() {
- return $this->hasOne(Producto::class, ['id' => 'idPadre']);
- }
- /**
- * Gets query for [[Productos]].
- *
- * @return \yii\db\ActiveQuery
- */
- public function getProductos() {
- return $this->hasMany(Producto::class, ['idPadre' => 'id']);
- }
- }
|