View PaginatorComponent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller\Component; | |
use Cake\Controller\Component\PaginatorComponent as CorePaginatorComponent; | |
use Cake\Datasource\QueryInterface; | |
use Cake\Network\Exception\NotFoundException; | |
class PaginatorComponent extends CorePaginatorComponent | |
{ |
View gist:5bfc5c33dfd9b59b8388
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param Event $event | |
* @param Query $query | |
* @return void | |
*/ | |
public function beforeFind(Event $event, Query $query) { | |
$this->encodeBitmaskConditions($query); | |
$field = $this->_config['field']; | |
if (!($mappedField = $this->_config['mappedField'])) { |
View gist:5dc3b85a43a969ccde01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array( | |
(int) 0 => array( | |
'ParentCategory' => array( | |
'id' => '1', | |
'name' => 'Lorem ipsum dolor sit amet', | |
'parent_id' => '1' | |
) | |
) | |
) |
View gist:2541d9139ca4598cf000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Overwrite completly: | |
public function setup(Model $Model, $config = array()) { | |
$this->settings[$Model->alias] = $config + $this->_defaultConfig; | |
} | |
Merge: | |
public function setup(Model $Model, $config = array()) { |
View gist:6080212
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function afterFind($results, $primary = false) { | |
if (!$primary && $this->attached('Translate')) { | |
$results = $Model->Behaviors->Translate->afterFind($this, $results, $primary); | |
} | |
... | |
} |