Extending the Framework: Unterschied zwischen den Versionen

Aus CodeCoupler Wiki
Zur Navigation springen Zur Suche springen
Tm (Diskussion | Beiträge)
Die Seite wurde neu angelegt: „== Some Basic Rules == '''Exception Handling''' # All functions of libaries and models should fire an exception if something goes wrong. Do not return "false…“
 
Tm (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
== Some Basic Rules ==
The Framework was developed based on some common rules and patterns. If you want to extend the framework you should know about the libraries and helpers used by the other components.


'''Exception Handling'''
= Fundamentals =
 
== Exception Handling ==


# All functions of libaries and models should fire an exception if something goes wrong. Do not return "false" or something similar to represent an error.
# All functions of libaries and models should fire an exception if something goes wrong. Do not return "false" or something similar to represent an error.
# All database-queries should be executed via "dbquery($query)". This helper-function provides a pattern for database queries including a correct exception handling. Read more here: [[Helper: dbquery]]
# All database-queries should be executed via "dbquery($query)". This helper-function provides a pattern for database queries including a correct exception handling. Read more here: [[Helper: dbquery]]
# If you want to use in your libraries some other CodeIgniter libraries you should call "enable_excpetion()" of the extended exceptions-class. This will modify the behaviour of "show_error()" so it will throw an exception. Read more here: [[Extended Core: Exceptions]]
# If you want to use in your libraries some other CodeIgniter libraries you should call "enable_excpetion()" of the extended exceptions-class. This will modify the behaviour of "show_error()" so it will throw an exception. Read more here: [[Extended Core: Exceptions]]
= Additional Components =


== Extended Core ==
== Extended Core ==

Version vom 22. August 2012, 17:41 Uhr

The Framework was developed based on some common rules and patterns. If you want to extend the framework you should know about the libraries and helpers used by the other components.

Fundamentals

Exception Handling

  1. All functions of libaries and models should fire an exception if something goes wrong. Do not return "false" or something similar to represent an error.
  2. All database-queries should be executed via "dbquery($query)". This helper-function provides a pattern for database queries including a correct exception handling. Read more here: Helper: dbquery
  3. If you want to use in your libraries some other CodeIgniter libraries you should call "enable_excpetion()" of the extended exceptions-class. This will modify the behaviour of "show_error()" so it will throw an exception. Read more here: Extended Core: Exceptions

Additional Components

Extended Core

  • Exceptions:
    Here you can tell CodeIgniter to throw real exceptions.

Helper

  • dbquery:
    Pattern for database queries.

Abstract Models

Abstract model classes are implemented as codeigniter-helper. There is no other way to use the codeigniter-loader without to be forced to instatiate a class.

Model

  • Tree:
    Abstract class to build a model interacting with a table representing data in a hierachical structure.