Kelas CApplication merupakan base class dari seluruh kelas aplikasi. CApplication merupakan turunan dari CModule >> CComponent . Lokasi filenya ada di framework/base/CApplication.php .

Aplikasi melayani sebagi global konteks dimana permintaan user(user request) diproses. Ia melakukan manajemen dari komponen-komponen aplikasi yang menyediakan fungsi-fungsi khusus kepada keseluruhan aplikasi.

Komponen aplikasi yang inti(the core application components) yang disediakan CApplication adalah:

  • errorHandler()
  • securityManager
  • statePersister
  • cache
  • messages
  • coreMessages

Saat memproses suatu user request, CApplication akan menjalankan siklus

  1. Meload konfigurasi dari aplikasi
  2. Mensetup kelas autoloader dan error handling
  3. Meloak komponen aplikasi yang static
  4. onBeginRequest
  5. processRequest
  6. onEndRequest

Berdasarkan informasi di website www.yiiframework.com kita mendapatkan informasi public property, public method, protected method dan avent yang akan disampaikan di bawah ini.

Public property dari CApplication adalah

  • basePath
  • cache
  • charset
  • coreMessages
  • dateFormatter
  • db
  • errorHandler
  • extension{ath
  • id
  • language
  • locale
  • localeDataPath
  • messages
  • name
  • numberFormatter
  • request
  • runtimePath
  • securityManager
  • sourceLanguage
  • statePersister
  • timeZone
  • urlManager

Public method dari CApplication adalah

  • __construct()
  • clearGlobalState()
  • displayError()
  • displayException()
  • end()
  • findLocalozedFile()
  • getBasePath()
  • getCache()
  • getCoreMessages()
  • getDateFormatter()
  • getDb()
  • getErrorHandler()
  • getExtensionPath()
  • getGlobalState()
  • getId()
  • getLanguage()
  • getLocale()
  • getLocaleDataPath()
  • getMessages()
  • getNumberFormatter()
  • getRequest()
  • getRuntimePath()
  • getSecurityManager()
  • getStatePersister()
  • getTimeZone()
  • getUrlManager()
  • handleError()
  • handleException()
  • loadGlobalState()
  • onBeginRequest()
  • onEndRequest()
  • onError()
  • onException()
  • processRequest()
  • run()
  • saveGlobalState()
  • setBasePath()
  • setExtensionPath()
  • seGlobalState()
  • setId()
  • setLanguage()
  • setLocaleDataPath()
  • setRuntimePath()
  • setTimeZone()

Sedangkan protected methodnya adalah :

  • initSystemHandlers()
  • registerCoreComponents()

Sedangkan eventnya adalah: 

  • onBeginRequest
  • onEndRequest
  • onException
  • onError

Kunjungi www.proweb.co.id untuk menambah wawasan anda.

Kelas CApplication pada Yii
× Ada yang dapat saya bantu ? Available on SundayMondayTuesdayWednesdayThursdayFridaySaturday