<?php
  class DMRDatabaseRepository extends ModelRepository
  {
    private static $_singletonInstance = null;

    public function __construct()
    {
      parent::__construct('DMRDatabase');
    }

    /**
     * Returnes an initiated PacketOgnRepository
     *
     * @return DMRDatabaseRepository
     */
    public static function getInstance()
    {
      if (self::$_singletonInstance === null) {
          self::$_singletonInstance = new DMRDatabaseRepository();
      }

      return self::$_singletonInstance;
    }


    /**
     * Get object by id
     *
     * @param  string $callsign (Callsign of the station)
     * @return array List of DMRDatabase objects
     */
    public function getObjectListByCallsign($callsign = null)
    {
        if (is_null($callsign) || empty($callsign))
        {
            return new DMRDatabase(null);
        }

        $sql = 'SELECT * FROM dmr WHERE call_sign = ?';
        return $this->getObjectListFromSql($sql, [$callsign]);
    }
  }
?>
