注意(8):未定义的变量cakePHP 3

时间:2016-01-06 11:58:59

标签: cakephp-3.0 cakephp-3.x

在网上搜索了几个小时之后,我决定在这里发布我的问题,希望找到解决方案

以下是我的视图add_by_complex.ctp中的代码:

<div class="immeubles form large-10 medium-9 columns content">
  <?= $this->Form->create($immeuble); /* line 9 */ ?>
    <fieldset>
      <legend><?= __('Ajouter un immeuble') ?></legend>
      <?php echo $this->Form->input('name',['label' => 'Nom']); ?>
    </fieldset>
    <?= $this->Form->button(__('Valider')) ?>
  <?= $this->Form->end() ?>
</div>

以下是错误消息:

  

注意(8):未定义的变量:immeuble
[APP / Template \ Immeubles \ add_by_complex.ctp,第9行]

有什么问题?非常感谢

1 个答案:

答案 0 :(得分:2)

使用上下文创建表单时,您必须向--- streams_mq_group: "mqm" streams_mq_user: "mqm" streams_mq_password: "password" streams_mq_config_default_port: "5672" streams_mq_config_channel_port: "5673" mq_install_root: "/opt/IBM/mqm" mq_install_temp: "/tmp/mqm" mq_archive_source_dir: "https://repo.com/maven_central/repository/HIT" mq_archive_tar: "mqadv_dev80_linux_x86-64.tar.gz" mq_version: "8.0.0-4" mq_cp_install_temp: "/tmp/mqm_cp" mq_cp_archive_tar: "8.0.0-WS-MQ-LinuxX64-FP0004.tar.gz" mq_cp_version: "U8004-8.0.0-4" mq_config_queue_manager: "QMGR_CLAIM" mq_config_channel_name: "CHNL_CLAIM" mq_var_volume: "/dev/sdc" mq_var_size: "10G" mq_log_volume: "/dev/sdb" mq_log_size: "100G" mq_root_volume: "/dev/sdd" mq_root_size: "10G" mq_server: "uapp1021d" puppetrole: "streams::messagequeue" profile::streams::messagequeue::mq_install_root: "%{hiera('mq_install_root')}" profile::streams::messagequeue::mq_install_temp: "%{hiera('mq_install_temp')}" profile::streams::messagequeue::mq_archive_source_dir: "%{hiera('mq_archive_source_dir')}" profile::streams::messagequeue::mq_archive_tar: "%{hiera('mq_archive_tar')}" profile::streams::messagequeue::mq_version: "%{hiera('mq_version')}" profile::streams::messagequeue::mq_cp_install_temp: "%{hiera('mq_cp_install_temp')}" profile::streams::messagequeue::mq_cp_archive_tar: "%{hiera('mq_cp_archive_tar')}" profile::streams::messagequeue::mq_cp_version: "%{hiera('mq_cp_version')}" profile::streams::messagequeue::mq_config_queue_manager: "%{hiera('mq_config_queue_manager')}" profile::streams::messagequeue::mq_config_channel_name: "%{hiera('mq_config_channel_name')}" profile::streams::messagequeue::mq_var_volume: "%{hiera('mq_var_volume')}" profile::streams::messagequeue::mq_var_size: "%{hiera('mq_var_size')}" profile::streams::messagequeue::mq_log_volume: "%{hiera('mq_log_volume')}" profile::streams::messagequeue::mq_log_size: "%{hiera('mq_log_size')}" profile::streams::messagequeue::mq_root_volume: "%{hiera('mq_root_volume')}" profile::streams::messagequeue::mq_root_size: "%{hiera('mq_root_size')}" profile::streams::messagequeue::mq_server: "%{hiera('mq_server')}" profile::streams::messagequeue::mq_group: "%{hiera('streams_mq_group')}" profile::streams::messagequeue::mq_user: "%{hiera('streams_mq_user')}" profile::streams::messagequeue::mq_password: "%{hiera('streams_mq_password')}" profile::streams::messagequeue::mq_config_default_port: "%{hiera('streams_mq_config_default_port')}" profile::streams::messagequeue::mq_config_channel_port: "%{hiera('streams_mq_config_channel_port')}" 方法表单提供Entity或ArrayContext。

  

$ model参数用作表单的'context'。有几个内置的表单上下文,你可以添加自己的,我们将在下一节中介绍。内置提供程序映射到$ model的以下值:

http://book.cakephp.org/3.0/en/views/helpers/form.html#starting-a-form

如果您不提供任何参数,则会假设您只构建一个提交给控制器的表单。

为了能够访问视图中的实体或任何其他变量,您必须set the View variable