CakePHP:带有saveMany的未知列

时间:2014-01-10 20:05:27

标签: php mysql cakephp

我有以下数组,我正在尝试保存到数据库..

$this->ProgramApplication->saveMany($priApps);  

$priApps:
Array
(
    [0] => Array
        (
            [ProgramCurrentResidence] => Array
                (
                    [program_id] => 3698076220130520
                    [customer_id] => jraer4081
                    [residence_duration] => 61-90-days
                    [residence_stability] => renting-leasing
                    [payment_current] => yes
                    [payment_amount_past_due] => 
                    [landlord_name] => Blake Woods
                    [landlord_phone] => (269)777-7777
                    [landlord_fax] => 
                    [notes] => 
                )


            [ProgramPreviousResidence] => Array
                (
                    [program_id] => 3698076220130520
                    [customer_id] => jrayner4081
                    [residence_duration] => 1year 
                    [street_address] => 1637 Colfax Ave
                    [city] => The Harbor
                    [state] => me
                    [zip] => 49022
                )
            )

    )

不断抛出以下错误......

数据库错误 错误:SQLSTATE [42S22]:找不到列:1054'where子句'中的未知列'ProgramCurrentResidence.program_id'

SQL查询:SELECT ProgramApplicationprogram_idProgramApplicationcustomer_idProgramApplicationsecondary_customer_idProgramApplication。{ {1}},secondary_customer_relationshipProgramApplicationsales_associateProgramApplicationstoreProgramApplicationcreated_on。{{1 },ProgramApplicationdate_submittedProgramApplicationdate_deliveredProgramApplicationstock_numberProgramApplicationdeal_statusProgramApplicationdeal_status_conditional_reasoningProgramApplicationtransfered_to_dealpackProgramApplicationpresubmittal_notesProgramApplicationunderwriters_notes FROM { {1}}。ProgramApplication AS modified_by WHERE((expreta2_x12programs ='3698076220130520')和(ProgramApplicationProgramCurrentResidence =' jrayner4081'))LIMIT 1

这是我的ProgramCurrentResidence模型......

program_id

程序应用程序模型中的一些代码

ProgramCurrentResidence

这可能是你所说的..

customer_id

我知道该表包含所使用的每个字段但由于某种原因它继续吐出此错误?我假设它的模型,但我可能是错的。

1 个答案:

答案 0 :(得分:0)

您似乎正在对ProgramApplication进行查找,而ProgramApplication中的模型与ProgramCurrentResidence没有任何关系。 您可能需要向ProgramApplication模型添加hasOne或hasMany of ProgramCurrentResidence。