title: Trying to get property with non-object in yii
body: <p>Im trying to get value from my database. But all the time yii tells me</p>
  
  <blockquote>
    <p>Trying to get property of non-object</p>
  </blockquote>
  
  <p>I'm sure I have this property in my controller, sending to in my view and then I want to show it. But I cant.<br>
  Below is my controller function, it's a part of my controller.</p>
  
  <pre><code>$car_reservation = CarReservation :: find() -&gt; all();
  $projects=Project::find()
      //-&gt;select(SAAS.'project.*')
      // -&gt;joinWith('projectMembers')
      //-&gt;where(SAAS.'project_member.user_id='.Yii::$app-&gt;user-&gt;id.' ')          
      -&gt;orderBy('project_title ASC')
      -&gt;all();  
      $users = User::find()-&gt;all();
  
      return $this-&gt;render($render, array('users'=&gt;$users,'car_reservation'=&gt;$car_reservation,'projects'=&gt;$projects,'cars'=&gt;$cars,'rooms'=&gt;$rooms,'today' =&gt; $today, 'minute_list' =&gt; $minute_list, 'hours_list' =&gt; $hours_list, 'status' =&gt; $status, 'tasks' =&gt; $tasks, 'taskstatuses' =&gt; $taskstatus));
  }
  </code></pre>
  
  <p>Then I want to show it in view. </p>
  
  <pre><code>&lt;form action="javascript:void(0)" enctype="multipart/form-data" id="cars-edit-modal"&gt;
  &lt;div class="modal-body"&gt;
      &lt;div class="tab-content"&gt;
          &lt;div role="tabpanel" class="tab-pane active"&gt;
              &lt;div class="row" &gt;
                  &lt;div class="col-sm-6" &gt;
                      &lt;?= Yii::t('app','Select car') ?&gt;
                  &lt;/div&gt;
                  &lt;div class="col-sm-12 mt10 p0i" &gt;
                      &lt;select class="form-control" name="car_id" data-rel="chosen-car" id="modal-car" data-placeholder="-
                          &lt;?= Yii::t('app','select') ?&gt;-"  &gt;
                          &lt;option  value="
                              &lt;?= $car-&gt;car_name ?&gt;" &gt;-
                              &lt;?= Yii::t('app','select') ?&gt;-
                          &lt;/option&gt;
                          &lt;?php 
  foreach($cars as $cr) { ?&gt;
                          &lt;option value='
                              &lt;?= $cr-&gt;car_name ?&gt;;'&gt;
                              &lt;?= $cr-&gt;car_name ?&gt;
                          &lt;/option&gt;
                          &lt;?php }  ?&gt;
                      &lt;/select&gt;
                  &lt;/div&gt;
                  &lt;div class="col-sm-12 mt10 p0i" &gt;
                      &lt;textarea class="modal-input-button form-control" value="
                          &lt;?= $car_reservation-&gt;car_reservation_note ?&gt;" name="text_car_edit" id="modal-cars" data-placeholder="-
                          &lt;?= Yii::t('app','Put a note') ?&gt;-" &gt;
                      &lt;/textarea&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer pull-left w100p"&gt;
      &lt;div class="col-sm-1 mt10 text-right" &gt;
          &lt;input type="hidden" name="_csrf" value="
              &lt;?=Yii::$app-&gt;request-&gt;getCsrfToken()?&gt;" /&gt;
              &lt;button type="submit" class="btn btn-primary"&gt;
                  &lt;?= Yii::t('app','Save') ?&gt;
              &lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm confused, because the yii doesn't know property of $car_reservation.                       </p>