for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Sample extends AppModel {
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
public $belongsTo = array('Apple');
/**
* afterFind
*
* @param array $results Results
* @param bool $primary Primary
* @return array
*/
public function afterFind($results, $primary = false) {
foreach ($results as &$result) {
$apple = $this->Apple->find('first', array(
'fields' => array(
'Apple.id',
'Apple.apple_id',
),
'contain' => array(
'ParentApple' => array('fields' => array('id', 'name')),
'conditions' => array('Apple.id' => $result[$this->alias]['id']),
));
if ($apple) {
$apple = $apple['Apple'] + $apple;
unset($apple['Apple']);
}
$result[$this->alias]['Apple'] = $apple;
return $results;
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.