for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Apple 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(
'ParentApple' => array(
'className' => 'Apple',
'foreignKey' => 'apple_id'
)
);
public $hasOne = array(
'SampleA' => array(
'className' => 'Sample',
'conditions' => array(
'SampleA.id' => 1,
),
'external' => true,
public $hasMany = array(
'Sample'
/**
* Constructor
*
* @param mixed $id ID
* @param string $table Table
* @param string $ds DataSource
*/
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->hasOne['NextApple'] = array(
'foreignKey' => 'apple_id',
'finderQuery' => $this->getNextAppleFinderQuery(),
}
* Finder query for NextApple
* @return string
public function getNextAppleFinderQuery() {
$db = $this->getDataSource();
return $db->buildStatement(
array(
'fields' => $db->fields($this, 'NextApple', array('id', 'apple_id', 'name', 'color', 'created', 'modified')),
'alias' => 'NextApple',
'table' => $db->fullTableName($this),
'id >' => '{$__cakeID__$}',
'limit' => 1,
$this
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.