【问题标题】:500 | Internal Server Error | Doctrine_Record_UnknownPropertyException Unknown record property500 |内部服务器错误 | Doctrine_Record_UnknownPropertyException 未知记录属性
【发布时间】:2012-04-10 01:39:31
【问题描述】:

我将在线站点复制到 localhost。登录后出现以下错误。 但在线服务器工作 gud。

500 |内部服务器错误 | Doctrine_Record_UnknownPropertyException “层”上的未知记录属性/相关组件“id”

请帮忙看看有什么问题。

这是 schema.yml。

##########
# USER
##########
Personal:
  columns:
    user_id:                { type: integer, notnull: true }
    full_name:              { type: string(255), notnull: true }
    sex:                    { type: integer(1), notnull: true } #use constant value, 1 = Male, 2 = Female
    birth_date:             { type: date, notnull: true }
    relationship_status:    { type: integer(1), notnull: true } #use constant value, 1 = Single, 2 = In a relationship, 3 = Engaged, 4 = Married, 5 = It's complicated, 6 = In an open relationship, 7 = Widowed, 8 = Separated, 9 = Divorced
    country_id:             { type: integer }
    zone_id:                { type: integer }
    occupation:             { type: string(255) }
    education:              { type: string(255) }
    hobbies:                { type: string(255) }
    professional_interests: { type: string(255) }
    about_me:               { type: string(1000) }
    alias:                  { type: string(255), notnull: true }
    primary_album_id:       { type: integer }
    primary_layer_id:       { type: integer }
    profile_picture_id:     { type: integer }
    alias_picture_id:       { type: integer }
  relations:
    User:           { class: sfGuardUser, local: user_id, foreign: id, onDelete: CASCADE }
    Country:        { local: country_id, foreign: id, onDelete: SET NULL }
    Zone:           { local: zone_id, foreign: id, onDelete: SET NULL }
    PrimaryAlbum:   { class: Album, local: primary_album_id, onDelete: SET NULL }
    PrimaryLayer:   { class: Layer, local: primary_layer_id, onDelete: SET NULL }
    ProfilePicture: { class: Picture, local: profile_picture_id, onDelete: SET NULL }
    AliasPicture:   { class: Picture, local: alias_picture_id, onDelete: SET NULL }



   Layer:
  columns:
    id:        {type:  integer, notnull:  true } 
    personal_id:     { type: integer, notnull: true }
    name:            { type: string(255), notnull: true }
    picture_id:  { type: integer, primary: true }

    privacy_setting: { type: string(64), notnull: true }  
  relations:
    Personal: { local: personal_id, foreign: id, onDelete: CASCADE }



    abstract class BasePersonal extends sfDoctrineRecord
       {
        public function setTableDefinition()
        {
            $this->setTableName('personal');
       $this->hasColumn('user_id', 'integer', null, array(
         'type' => 'integer',
         'notnull' => true,
         ));

             $this->hasColumn('primary_layer_id', 'integer', null, array(
         'type' => 'integer',
         ));



   public function setUp()
   {
    parent::setUp();
        $this->hasOne('Layer as PrimaryLayer', array(
         'local' => 'primary_layer_id',
         'foreign' => 'id',
         'onDelete' => 'SET NULL'));

       $this->hasMany('Layer', array(
         'local' => 'id',
         'foreign' => 'personal_id'));



           abstract class BaseLayer extends sfDoctrineRecord
            {
           public function setTableDefinition()
         {
              $this->setTableName('layer');
              $this->hasColumn('personal_id', 'integer', null, array(
               'type' => 'integer',
              'notnull' => true,
                ));


       public function setUp()
         {
             parent::setUp();
             $this->hasOne('Personal', array(
         'local' => 'personal_id',
         'foreign' => 'id',
         'onDelete' => 'CASCADE'));

任何机构,帮助我。

【问题讨论】:

  • 嗨 j0k,你的 cmets 对我非常有用。请告诉我。我上面的代码中的问题是什么。在你的 cmets 前两天,解决了我的问题。谢谢。

标签: doctrine symfony-1.4


【解决方案1】:

在你的 schema.yml 中删除了这一行,让 Doctrine 做主键。

id:        {type:  integer, notnull:  true } 

【讨论】:

  • 嗨,好吧,我已经删除了该行,但同样的错误正在出现。
  • 您执行了./symfony cc./symfony doctrine:build --model 吗?
  • 嗨,开玩笑,我做了 symfony 学说:build --model,出现以下错误。无法解析文件:28 PrimaryLayer:{ class:Layer,local:primary_layer_id,onDelete:SET NULL }
  • 嗨,开玩笑,我检查了它 apache 错误日志-此错误正在comming 文件不存在:C:/wamp/www/public_html/web/sf,引用者:localhost/public_html/web/index.php/personal.plz 告诉他们解决方案。
  • 你忘记声明你的Alias /sf:symfony-project.org/getting-started/1_4/en/…
猜你喜欢
  • 1970-01-01
  • 2014-10-21
  • 2021-10-23
  • 1970-01-01
  • 2013-06-29
  • 1970-01-01
  • 2014-12-23
  • 2019-01-17
  • 2011-10-17
相关资源
最近更新 更多