Cakephp Classroom image

osdyui
 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17|Last
Lessons:-Core Libraries

Return type void
Initializes the cache for App, registers a shutdown function.
static App::load(string $className)
Return type boolean
Method to handle the automatic class loading. It will look for each class’ package defined using
App::uses() and with this information it will resolve the package name to a full path to load the
class from. File name for each class should follow the class name. For instance, if a class is name
MyCustomClass the file name should be MyCustomClass.php
static App::shutdown()
Return type void
Object destructor. Writes cache file if changes have been made to the $_map.
Events System
New in version 2.1. Creating maintainable applications is both a science and an art. It is well-known that a
key for having good quality code is making your objects loosely coupled and strongly cohesive at the same
time. Cohesion means that all methods and properties for a class are strongly related to the class itself and it
is not trying to do the job other objects should be doing, while loosely coupling is the measure of how little
a class is “wired” to external objects, and how much that class is depending on them.
While most of the CakePHP structure and default libraries will help you achieve this goal, there are certain
cases where you need to cleanly communicate with other parts in the system without having to hard
code those dependencies, thus losing cohesion and increasing class coupling. A very successful design pattern
in software engineering is the Observer pattern, where objects can generate events and notify possibly
anonymous listeners about changes in the internal state.
Listeners in the observer pattern can subscribe to such events and choose to act upon them, modify the
subject state or simply log stuff. If you have used javascript in the past, the chances are that you are already
familiar with event driven programming.
CakePHP emulates several aspects of how events are triggered and managed in popular javascript frameworks
such as jQuery, while remaining loyal to its object oriented design. In this implementation, an event
object is carried across all listeners holding the information and the ability to stop the event propagation at
any point. Listeners can register themselves or can delegate this task to other objects and have the chance to
alter the state and the event itself for the rest of the callbacks.
Interacting with the event managers
Let’s suppose you are building a Cart plugin, but you don’t really want to mess with shipping logic, emailing
the user or decrementing the item from the stock, it is your wish to handle those things separately in another
plugin or in app code. Typically, when not directly using the observer pattern you would do this by attaching
behaviors on the fly to your models, and perhaps some components to the controllers.
Doing so represents a challenge most of the time, since you would have to come up with the code for
externally loading those behaviors or attaching hooks to your plugin controllers. Prior to CakePHP 2.1

 
 
 

osdyui

Skills    Cakephp

Qualifications :-
Location :-,,,
Description:-
Explore
 

  Students (0)