<?php

namespace console\models;

use Yii;

/**
 * This is the model class for table "programmazione".
 *
 * @property integer $id
 * @property integer $schedule
 * @property integer $id_cinema
 * @property integer $id_sala
 * @property string $variato
 * @property string $codice_film
 * @property string $ctel_film
 * @property string $riduzioni
 * @property string $spettacoli
 *
 * @property Cinema $idCinema
 */
class Programmazione extends \yii\db\ActiveRecord {

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return 'programmazione';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['schedule','cinema', 'film'], 'required'],
            [['spettacoli'], 'string'],
            [['schedule','film'], 'string', 'max' => 32]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'schedule' => 'Schedule',
            'cinema' => 'Cinema',
            'film' => 'Film',
            'spettacoli' => 'Spettacoli',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getRelatedCinema() {
        return $this->hasOne(Cinema::className(), ['codice' => 'cinema']);
    }
    public function getRelatedFilm() {
        return $this->hasOne(Film::className(), ['codice' => 'film']);
    }

}
