Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP:包含saveMany的未知列_Php_Mysql_Cakephp - Fatal编程技术网

CakePHP:包含saveMany的未知列

CakePHP:包含saveMany的未知列,php,mysql,cakephp,Php,Mysql,Cakephp,我正在尝试将以下数组保存到数据库中 $this->ProgramApplication->saveMany($priApps); $priApps: Array ( [0] => Array ( [ProgramCurrentResidence] => Array ( [program_id] => 3698076220130520

我正在尝试将以下数组保存到数据库中

$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]:未找到列:“where子句”中的1054未知列“ProgramCurrentResidence.program_id”

SQL查询:选择
programmapplication
programmapplication
programmapplication
programmapplication
secondary\u-customer\u-id
secondary\u-customer\u-relationship
programmapplication
销售助理
程序应用程序
存储,
程序应用程序
在上创建,
程序应用程序
提交日期,
程序应用程序
交付日期,
程序应用程序
股票编号,
程序应用程序
交易状态,
programmapplication
deal\u status\u conditional\u reasoning
programmapplication
转移到dealpack,
programmapplication
预提交说明,
programmapplication
承销商说明,
ProgramApplication
expreta2\u x12
中的
programs
修改为
ProgramApplication
其中(
ProgramCurrentResidence
program\u id
ProgramCurrentResidence
客户id
=jrayner4081'))限制1

这是我的住宅模型

<?php
class ProgramCurrentResidence extends AppModel {

    public $useTable = 'program_current_residences';

    public $primaryKey = 'program_id';

    public $belongsTo = array(
        'ProgramApplication' => array(
            'foreignKey' => 'program_id'
            )
        );

}
?>

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

似乎您正在对ProgramApplication进行查找,而ProgramApplication中的模型与ProgramCurrentResidence没有关系您可能需要将一个或多个ProgramCurrentResidence添加到ProgramApplication model。

看起来数据是从expreta2_x12表中选择的,该表未连接到ProgramCurrentResidenceexpreta2_x12是数据库。添加了来自program application model的代码。它看起来正确吗?还是我需要添加一个hasMany?@Subie你能发布你的整个程序应用模型吗?因为从你给我看的情况来看,这似乎应该是可行的,问题可能是其他一些查询……你对上面某个地方的查找有“包含”吗?我们有一个包含。我已经在上面发布了。@Subie对不起,我再也没有回来,你解决你的问题了吗?碰巧是数组。你的回答有助于解决问题,所以谢谢你。
    <?php

class ProgramApplication extends AppModel {

    public $useTable = 'programs';
    public $primaryKey = 'program_id';

    public $actAs = array('Containable');

    public $belongsTo = array(
        'Inventory' => array(
            'foreignKey' => 'stock_number'
        ),
        'Customer' => array(
            'foreignKey' => 'customer_id'
        ),
        'Employee' => array(
            'foreignKey' => 'sales_associate'
        ),
        'CustomerPersonalInformation' => array(
            'foreignKey' => 'customer_id'
        ),
        'CustomerContactInformation' => array(
            'foreignKey' => 'customer_id'
        ),
        'CustomerMarketingOption' => array(
            'foreignKey' => 'customer_id'
        )
    );


    public $hasOne = array(
        'Desklog' => array(
            'foreignKey' => 'program_id'
        ),
        'Funding' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramCurrentResidence' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramPreviousResidence' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramCurrentEmployment' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramPreviousEmployment' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramIncome' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramReference' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramAdditionalInformation' => array(
            'foreignKey' => 'program_id'
        ),
        'ProgramDoublePreviousEmployment'=> array(
            'foreignKey' => 'program_id'
        ),
        'ProgramDoublePreviousResidence'=> array(
            'foreignKey' => 'program_id'
        ),
        'ProgramExpense'=> array(
            'foreignKey' => 'program_id'
        ),
        'ProgramVerificationWorksheet'=> array(
            'foreignKey' => 'program_id'
        )
    );

}

?>
// Get all the data corrosponding to the secondary customer
                $secondaryRow = $this->Customer->find('all', array(
                    'conditions' => array("Customer.customer_id" => $secondary),
                    'contain' => array(
                        'CustomerPersonalInformation',
                        'CustomerContactInformation',
                        'CustomerMarketingOption',
                        'ProgramApplication' => array(
                            'ProgramCurrentResidence',
                            'ProgramPreviousResidence',
                            'ProgramCurrentEmployment',
                            'ProgramPreviousEmployment',
                            'ProgramIncome',
                            'ProgramAdditionalInformation',
                            'ProgramDoublePreviousEmployment',
                            'ProgramDoublePreviousResidence',
                            'ProgramExpense',
                            'ProgramVerificationWorksheet'
                        ),
                        'CustomerInteraction'
                    ),
                ));