2016-08-08 15 views
0

を解決する方法こんにちは私は、このエラーメッセージを受信:CakePHPは私は、サーバー上で自分のアプリケーションを実行すると「非オブジェクトのプロパティを取得しようとすると」エラー

Notice (8): Trying to get property of non-object [APP/Template/ApplicantEducationNeeds/view.ctp, line 52] 

をし、これが行です

<?php 

    use Cake\Cache\Cache; 
    use Cake\Core\Configure; 
    use Cake\Datasource\ConnectionManager; 
    use Cake\Error\Debugger; 
    use Cake\Network\Exception\NotFoundException; 

    $this->layout = 'userProfile'; 

    if (!Configure::read('debug')): 
     throw new NotFoundException(); 
    endif; 

    //echo debug($applicantDesiredEducations); 

    ?> 

    <div class='col-md-12'> 
     <div class="applicantGenerals view large-9 medium-8 columns content"> 

      <div class ='col-md-4'> 
       <h3><?= __('Desired Education') ?></h3> 
        <table class="table"> 
         <thead> 
          <tr> 
           <th><?= __('Field Of Studies') ?></th> 
           <th class="actions"><?= __('Actions') ?></th> 
          </tr> 
         </thead> 
         <tbody> 
          <?php foreach ($applicantDesiredEducations as $applicantDesiredEducation): ?> 
          <tr> 
//here the lines of 50's 
           <td><?= $_language == 'en_US' ? h($applicantDesiredEducation->education_field_of_study_sub->name_en) : h($applicantDesiredEducation->education_field_of_study_sub->name_ara) ?></td> 

が、予告私はその作品が細かい私のローカルマシンにこのコードを台無しにする場合、いずれかの有望な解決策は、それは降水

次のようになります。view.ctpのコードの

答えて

1

ただの推測、あなたがあなたのエラーに関する多くの情報を提供していないので:あなたは$applicantDesiredEducationsをループさ

、おそらくすべての$applicantDesiredEducationはあなたが$applicantDesiredEducation->education_field_of_study_sub->name_en呼び出すときですから、そのエラーを取得しeducation_field_of_study_sub

を持っていない

あなたは

if(isset($applicantDesiredEducation->education_field_of_study_sub)) 
{ 
    echo h($applicantDesiredEducation->education_field_of_study_sub->name_en); 
} 
+0

のようなものが今、あなたにその作業を感謝し、財産のexixtenceのチェックを挿入する必要があります!!! – user1870982

+0

質問に同意してフラグを立ててください – arilia

関連する問題