ATK4 model not found when moving to online

前端 未结 3 1714
-上瘾入骨i
-上瘾入骨i 2020-12-22 00:58

I am developing a website using ATK4, a php framework with jquery.

I have developed this on my laptop using localhost/test1 as the directory and with a local php dat

3条回答
  •  清酒与你
    2020-12-22 01:48

    OK, seems a bit strange but this is what i found.

    I have a model called Task which extends Table.

    class Model_Task extends Model_Table {
    public $entity_code='vscrum_task';
        public $table_alias='tk';
    
    function init(){
      parent::init();
      $this->addField('id')->system(true)->visible(false);
      $this->addField('story_id')->system(true)->visible(false);
      $this->addField('backlog_ref')->system(true)->visible(false);
    
      $this->addField('status')->defaultValue('I')->visible(false);
      $this->addField('task_desc')->mandatory(true)->visible(true);
    
          $this->addField('member_id')->mandatory(true)->refModel('model_Member');
    
          // join colour
          $this->addRelatedEntity('ty','vscrum_tasktype','tasktype_id','left');
    
          //tasktype
          $this->addField('tasktype_id')->refModel('model_TaskType')->mandatory(true);
     }
    

    I have a model called ScrumwallTask which extends Task

    class Model_ScrumwallTask extends Model_Task {
    
    function init(){
      parent::init();
    
      $this->addField('status')->defaultValue('I')->system(true);
          $this->addField('colour_desc')->datatype('text')->calculated(true);
          $this->addField('status')->visible(true);
    
        }
    
    function calculate_colour_desc(){
            return $this->api->db->dsql()
                ->table('vscrum_colour')
                ->where('id=ty.colour_id')
                ->field('colour_desc')
                ->select();
        }
    }
    

    ScrumwallTask calls parent::init so i assumed it would get all the fields added to Task

    I got rid of the error by duplicating the addField for tasktype_id into ScrumwallTask even though it is already defined in the parent Task.

    $this->addField('tasktype_id')->refModel('Model_TaskType');

    Is that expeced behaviour for inheritance of models ? What is really confusing is that it worked fine on localhost (Windows 7) !

提交回复
热议问题