środa, 10 listopada 2010

rereading book part 2

Use of Model::set
$this->Post->read(null, 1);
$this->Post->set(array(
 'title' => 'New title',
 'published' => false
));
$this->Post->save();
 Model::save - alternative

save(array $data = null, array $params = array())
$params = array(
 'validate' => true,
 'fieldList' => array(),
 'callbacks' => true //other possible values are false, 'before', 'after'
)
http://book.cakephp.org/view/1031/Saving-Your-Data#counterCache-Cache-your-count-1033
 deleteAll(mixed $conditions, $cascade = true, $callbacks = false)
 
unbindModel only affects the very next find function. An additional find call will use the configured association information.
 $this->element('helpbox',
    array(
        "cache" => array('time'=> "+7 days",'key'=>'unique value')
    )
);
 
$this->cakeError(string $errorType [, array $parameters]);
 
debug($var, $showHTML = false, $showFrom = true):
Output from this function is only shown if the core debug variable has been set to a value greater than 0.
 
Session component 
cache
Use the caching engine configured by Cache::config(). Very useful in conjunction with Memcache (in setups with multiple application servers) to store both cached data and sessions.
 
 

wtorek, 9 listopada 2010

rereading book

Some methods i found reading cake book. just to take closer look in the future.

constructClasses, referer

http://book.cakephp.org/view/1017/Retrieving-Your-Data#Complex-Find-Conditions-1030

to be continued.

poniedziałek, 1 listopada 2010

Request action!

Copied from the book:
This allows the requestAction call to bypass the usage of Router::url which can increase performance. The url based arrays are the same as the ones that HtmlHelper::link uses with one difference - if you are using named or passed parameters, you must put them in a second array and wrap them with the correct key. This is because requestAction only merges the named args array into the Controller::params member array and does not place the named args in the key 'named'.

echo $this->requestAction('/articles/view/5');
echo $this->requestAction(array('controller' => 'articles', 'action' => 'view'), array('pass' => array(5)));