我正在使用cakephp在网站上工作,该项目在localhost上运行完美,但是当我上传到我的CONTABO VPS时,我发现了一个问题(hasmany),即我失去了模型之间的关系
模型示例:
public $belongsTo = array(
'category' => array(
'className' => 'categories',
'foreignKey' => 'id_category'
)
);
public $hasMany = array(
'model_globale' => array(
'className' => 'model_globales',
'foreignKey' => 'id_type'
),
'typejobe' => array(
'className' => 'typejobes',
'foreignKey' => 'id_type'
)
);
所以当我在localhost上调试时,我得到了这个:
\app\Controller\ModelesController.php (line 70)
array(
(int) 0 => array(
'type' => array(
'id' => '1',
'name' => 'carte de visite',
'id_category' => '1',
'created' => '0000-00-00 00:00:00'
),
'category' => array(
'id' => '1',
'name' => 'Imprimerie',
'created' => '0000-00-00 00:00:00'
),
'model_globale' => array(
(int) 0 => array(
'id' => '22',
'id_type' => '1',
'id_job' => '1',
'id_chart_graphique' => '0',
'id_user' => '8',
'id_subtype' => '3',
'source' => '0',
'created' => '2014-01-07 09:57:39',
'modified' => '2014-01-07 09:57:39'
)
),
'typejobe' => array(
(int) 0 => array(
'id_type' => '1',
'id_jobe' => '1'
),
(int) 1 => array(
'id_type' => '1',
'id_jobe' => '2'
),
(int) 2 => array(
'id_type' => '1',
'id_jobe' => '5'
)
)
)
)
但是当我调试时,我的CONTABO VPS只得到:
array(
(int) 0 => array(
'type' => array(
'id' => '1',
'name' => 'carte de visite',
'id_category' => '1',
'created' => '0000-00-00 00:00:00'
)
)
)
答案 0 :(得分:0)
托管项目时的主要问题是系统更改。
迁移问题的90%是由于这个问题。谢谢你检查是否有缺失的上限,或者你有没有目的的一套。
PS:还有一个必须检查的递归属性。