<?php

class SpiIntExtKodeMapping extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var string
     */
    public $code_key;

    /**
     *
     * @var string
     */
    public $variable;

    /**
     *
     * @var string
     */
    public $type;

    /**
     *
     * @var string
     */
    public $indikator_key;

    /**
     *
     * @var string
     */
    public $indikator;

    /**
     *
     * @var string
     */
    public $deskripsi;

    /**
     *
     * @var string
     */
    public $tipe;

    /**
     *
     * @var string
     */
    public $pertanyaan_gratif;

    /**
     *
     * @var string
     */
    public $kategori_gratif;

    /**
     *
     * @var string
     */
    public $cluster;

    /**
     *
     * @var string
     */
    public $komponen_gratif_key;

    /**
     *
     * @var string
     */
    public $komponen_gratif;

    /**
     *
     * @var string
     */
    public $dimensi_gratif_key;

    /**
     *
     * @var string
     */
    public $dimensi_gratif;

    /**
     * Initialize method for model.
     */

    const TYPE_INTERNAL = 'INTERNAL';
    const TYPE_EXTERNAL = 'EXTERNAL';
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("spi_int_ext_kode_mapping");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'spi_int_ext_kode_mapping';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return SpiIntExtKodeMapping[]|SpiIntExtKodeMapping|\Phalcon\Mvc\Model\ResultSetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    public static function findGratifikasiOnly($order = 'komponen_gratif_key', $sort = 'ASC') {
        return self::find([
            'conditions' => 'komponen_gratif IS NOT NULL',
            'order' => $order . ' ' . $sort
        ]);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return SpiIntExtKodeMapping|\Phalcon\Mvc\Model\ResultInterface
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

}
