Symfony 1.4 /将新表添加到schema.yml时,Doctrine出现问题

问题描述 投票:0回答:1

我使用此架构将两个表添加到数据库:

Receiptjob:
 columns:
  charity_id:       integer
  sf_guard_user_id: integer
  created_at:        timestamp
  finished_at:      timestamp
  job_type:         string(32)
  job_status:       integer 
relations:
  User:
    class: sfGuardUser
  Charity:
    class: Charity
  Spende:
    class:     Spende
    refClass:  ReceiptjobMap
    type:      many
    local:     receiptjob_id
    foreign:   spenden_id

 ReceiptjobMap:
   columns:
     receiptjob_id:     integer
     spenden_id:        integer
     spenden_recurring: string(32)
    relations:
      Receiptjob:
        class:        Receiptjob
        local:        receiptjob_id
        foreign:      id
        onDelete:     CASCADE
       Spende:
         class:        Spende
         local:        spenden_id

一切正常,直到今天早上我启动我的Docker容器。我总是得到这个错误信息:

Uncaught Error: Call to a member function setTableName() on null in /var/www/vendor/lexpress/doctrine1/lib/Doctrine/Record/Abstract.php:140

我将尝试修复错误,但无济于事,至少我建立了一个新分支,再次添加了schema.yml并对其进行了迁移,但是错误仍然存​​在。...

我做错了什么?

php symfony doctrine symfony-1.4 doctrine-1.2
1个回答
0
投票

在我的情况下,我遇到了问题,因为我没有在类中调用parent :: _ construct,因为在BaseClass中没有__construct。但是BaseClass扩展了sfDoctrineRecord,并且有一个__construct。因此,这是setTableName在null上运行时的原因。

© www.soinside.com 2019 - 2024. All rights reserved.