【问题标题】:symfony 1.4.15 bug with php 7php 7 的 symfony 1.4.15 错误
【发布时间】:2017-06-08 09:39:49
【问题描述】:

我正在使用 PHP

当我在做的时候:

->select('k.*,v.*,t.*')
->from('DataKey k')
->leftJoin('k.Values v')

带配置:

DataKey:
   columns:
     type:                { type: string(5), notnull: true, comment: 'Type de donnée (list/int/text/float)' }
     description:         { type: string(255), notnull: true, comment: 'Libelle' }
     unit:                { type: string(10), notnull: false, comment: 'Unité de valeur' }

DataValue:
  columns:
     key_id:              { type: integer, notnull: true, comment: 'Identifiant de donnée' }
     value_id:            { type: string(10), notnull: true, comment: 'Identifiant de valeur' }
     description:         { type: string(255), notnull: true, comment: 'Libelle' }
  relations:
     DataKey:            { class: DataKey, local: key_id, foreign: id }

我收到了这个错误:

/doctrine/Doctrine/Relation.php 第 451 行 PHP消息: PHP 通知:
/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Relation.php 第 451 行中的数组到字符串转换

PHP 消息:未知记录属性/相关组件“

别名:数据键 外国:身份证 本地:key_id 类:数据键 类型:0 表:对象(DataKeyTable) 本地表:对象(数据值表) 姓名 : 参考表: 删除: 更新: 延期: 可延期: 约束: 平等的 : 级联:数组 拥有方: refClassRelationAlias : 外键名: 订购: ”关于“数据值”

有什么想法吗?

【问题讨论】:

  • 迁移到 PHP7 很棒,但我认为你应该先迁移到 symfony 3,或者至少迁移到 symfony2。
  • 我同意,我愿意。但我没有时间重写整个应用程序。我正在使用其他人编写的现有应用程序。
  • 在 PHP7 上进行测试是个好主意,但是如果您在供应商中遇到错误,现在要修复会很痛苦,或者必须自己修复代码。您应该尝试将应用程序逐步迁移到 Symfony3。保留旧的 PHP5 和新的 PHP7 服务器。
  • 我无法迁移到 symfony 3 我没有更多时间了。我的意思是,我不是系统管理员,也不是项目的老板:我的工作是将项目放在服务器上并使其运行。我有 3 个项目 symfony 1.4.20 使用推进而不是教条没有问题...

标签: php mysql symfony doctrine


【解决方案1】:

新的 PHP 语法有一点问题。

Doctrine/Collection.php

- $record->$relation['alias'] = $this->reference;
+ $record->{$relation['alias']} = $this->reference;

Doctrine/Query/Abstract.php

- $record->$callback['callback']($event);
- $table->getRecordListener()->$callback['callback']($event);
+ $record->{$callback['callback']}($event);
+ $table->getRecordListener()->{$callback['callback']}($event);

Details on the GitHub

【讨论】:

    猜你喜欢
    • 2012-08-24
    • 2017-08-13
    • 1970-01-01
    • 2017-07-15
    • 2018-08-22
    • 2019-01-05
    • 2018-08-22
    • 2019-02-12
    • 2017-08-14
    相关资源
    最近更新 更多