This file contains hidden or 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 | |
/** | |
* Exception Renderer Fixed | |
* Angel S. Moreno ([email protected]) | |
* | |
* As per ticket #3389 (http://cakephp.lighthouseapp.com/projects/42648/tickets/3389-exceptionrenderer-uses-the-wrong-viewclass) | |
* the ExceptionRenderer fails to use the proper view class when an exception is thrown in the AppController's beforeFilter. | |
* This new ExceptionRenderer extends the original and updates the view class based on RequestHandlerComponent::params['ext'] and | |
* Router::extensions(). It assumes that when RequestHandlerComponent::params['ext'] is set and the extention is in the array of | |
* Router::extensions(), that the viewClass to use is prefixed by the extension being used. That being said, when the extenion is |
This file contains hidden or 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 | |
/** | |
* For the latest version please visit https://github.com/angelxmoreno/CakePHP-Environment-Switcher | |
* | |
* Environment Switching class for CakePHP | |
* | |
* The class should be included in your webroot/index file right after the APP_DIR | |
* is defined, since this class uses the ROOT and APP_DIR constants. | |
* | |
* PHP 5 |
This file contains hidden or 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
/** | |
* Constructor. Binds the model's database table to the object. | |
* | |
* @param integer|string|array $id Set this ID for this model on startup, can also be an array of options, see above. | |
* @param string $table Name of database table to use. | |
* @param string $ds DataSource connection name. | |
*/ | |
public function __construct($id = false, $table = null, $ds = null) { | |
parent::__construct($id, $table, $ds); | |
//verify that all children have a $role |
This file contains hidden or 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 | |
//Controller | |
namespace App\Controller; | |
use App\Controller\AppController; | |
class ArticlesController extends AppController { | |
public function beforeRender(\Cake\Event\Event $event) { | |
parent::beforeRender($event); |
This file contains hidden or 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
was the ability to edit the wrapping div in the FormHelper::input() dropped in favor of the groupContainer template or has it not been implemented |
This file contains hidden or 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
was the ability to edit the wrapping div in the FormHelper::input() dropped in favor of the groupContainer template or has it not been implemented |
This file contains hidden or 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 | |
//if i dont have the id but i have the email | |
$email = '[email protected]'; | |
$new_pass = 'cakephp2014' | |
$user_id = $this->field('id', array('email' => $email)); | |
$this->User->save(array('id' => $user_id, 'password' => Security::hash($new_pass); |
This file contains hidden or 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 | |
App::uses('ConnectionManager', 'Model'); | |
$db = ConnectionManager::getDataSource('amazon'); | |
$books = $db->find('Books', array( | |
'title' => 'Harry Potter' | |
)); | |
debug($books); |
This file contains hidden or 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
debug($genres_movies); | |
########## DEBUG ########## | |
array( | |
'Movie' => array( | |
'id' => '1726' | |
), | |
'Genre' => array( | |
'Genre' => array( | |
(int) 0 => (int) 28, | |
(int) 1 => (int) 12, |
This file contains hidden or 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 | |
// in the User Model | |
App::uses('AppModel', 'Model'); | |
App::uses('SimplePasswordHasher', 'Controller/Component/Auth'); | |
class User extends AppModel { | |
public function beforeSave($options = array()) { | |
if (isset($this->data[$this->alias]['password'])) { | |
$passwordHasher = new SimplePasswordHasher(); | |
$this->data[$this->alias]['password'] = $passwordHasher->hash( |
OlderNewer