Php 为什么数据不是';是否未保存在关系表中?

Php 为什么数据不是';是否未保存在关系表中?,php,cakephp,frameworks,Php,Cakephp,Frameworks,我已经有了这个DB模型,我正在使用CakePHP构建一个简单的应用程序,只是为了了解我在哪里有这个add()方法: 这是我的add.ctp文件: <div class="information form"> <?php echo $this->Form->create('Information', array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'));?>

我已经有了这个DB模型,我正在使用CakePHP构建一个简单的应用程序,只是为了了解我在哪里有这个add()方法:

这是我的add.ctp文件:

<div class="information form">
<?php echo $this->Form->create('Information', array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'));?>
<fieldset>
    <legend><?php echo __('Add Information'); ?></legend>

    <ul class="nav nav-tabs">
        <li class="active"><a href="#personal" data-toggle="tab"><?php echo __('Personal') ?></a></li>
        <li><a href="#extra" data-toggle="tab"><?php echo __('Other Information') ?></a></li>
    </ul>

    <div class="tab-content">
        <div class="tab-pane active" id="personal">
            <div class="row">
                <div class="span4">
                    <?php
                        echo $this->Form->input('name', array('label' => __('Name')));
                        echo $this->Form->input('lastname');
                        echo $this->Form->input('email');
                        echo $this->Form->input('countries_id');
                        echo $this->Form->input('mobile_phone');
                        echo $this->Form->input('home_phone');
                    ?>
                </div><!--./span4-->
                <div class="span4">
                    <?php
                        echo $this->Form->input('address', array('cols' => 50, 'rows' => 5));
                        echo $this->Form->input('picture', array('type' => 'file'));
                        echo $this->Form->input('recruitment_status', array('label' => __('Status'),'options'=>array('1'=>__('Call for Interview'),'2'=>__('Rejected'),'3'=>__('Pending for Upcoming Oportunities'))));
                    ?>
                </div><!--./span4-->
            </div><!--./row-->
        </div>
        <div class="tab-pane" id="extra">
            <?php
                echo $this->Form->input('Education.0.education_content');
                echo $this->Form->input('Experience.0.experience_content');
                //echo $this->Form->input('Attachment.attachment_route', array('type' => 'file', 'multiple'));
                echo $this->Form->input('other_information');
            ?>
        </div>
    </div>
</fieldset>
<?php 
 $options = array(
'value' => __('Save!'),
'class' => 'btn btn-inverse'
 );
?>  
<div class="paginator-footer"> <?php echo $this->Form->end($options);?> </div>
</div>


但是这里有点不对劲,因为关联的数据从未保存过,也找不到问题所在?有什么可以帮我的吗?

请确保在模型中正确创建了关系,并使用saveAll而不是saveAssociated,因为saveAssociated不能同时保存多个条目。saveAll所做的基本上是将saveMany和saveAssociated组合成一个单一的保存方法。

我的信息模型是这样的,我认为它很好,请看一看,我也在使用saveAll,但没有成功。我不知道它是否能修复它,但请尝试更改它:public$hasMany=array('Educations'=>array(…),“体验”=>array(…),“附件”=>array(…);公开$hasMany=array('Education'=>array(…),'Experience'=>array(…),'Attachment'=>array(…);哇!你救了我,凯奥,非常感谢。我有另一个相关的问题,我可以在这里问,或者需要为此目的打开另一个帖子?打开另一个帖子。这很好,如果有人有同样的问题,他们可以很容易地找到它。
<div class="information form">
<?php echo $this->Form->create('Information', array('class' => 'form-horizontal', 'enctype' => 'multipart/form-data'));?>
<fieldset>
    <legend><?php echo __('Add Information'); ?></legend>

    <ul class="nav nav-tabs">
        <li class="active"><a href="#personal" data-toggle="tab"><?php echo __('Personal') ?></a></li>
        <li><a href="#extra" data-toggle="tab"><?php echo __('Other Information') ?></a></li>
    </ul>

    <div class="tab-content">
        <div class="tab-pane active" id="personal">
            <div class="row">
                <div class="span4">
                    <?php
                        echo $this->Form->input('name', array('label' => __('Name')));
                        echo $this->Form->input('lastname');
                        echo $this->Form->input('email');
                        echo $this->Form->input('countries_id');
                        echo $this->Form->input('mobile_phone');
                        echo $this->Form->input('home_phone');
                    ?>
                </div><!--./span4-->
                <div class="span4">
                    <?php
                        echo $this->Form->input('address', array('cols' => 50, 'rows' => 5));
                        echo $this->Form->input('picture', array('type' => 'file'));
                        echo $this->Form->input('recruitment_status', array('label' => __('Status'),'options'=>array('1'=>__('Call for Interview'),'2'=>__('Rejected'),'3'=>__('Pending for Upcoming Oportunities'))));
                    ?>
                </div><!--./span4-->
            </div><!--./row-->
        </div>
        <div class="tab-pane" id="extra">
            <?php
                echo $this->Form->input('Education.0.education_content');
                echo $this->Form->input('Experience.0.experience_content');
                //echo $this->Form->input('Attachment.attachment_route', array('type' => 'file', 'multiple'));
                echo $this->Form->input('other_information');
            ?>
        </div>
    </div>
</fieldset>
<?php 
 $options = array(
'value' => __('Save!'),
'class' => 'btn btn-inverse'
 );
?>  
<div class="paginator-footer"> <?php echo $this->Form->end($options);?> </div>
</div>