Advertisement
Guest User

Untitled

a guest
Jul 13th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. /* DataObject.php - loadLazyFields($tableClass = null) */
  2.  
  3.  
  4.                 ....
  5.  
  6.                 if ($columns) {
  7.                         $query = $dataQuery->query();
  8.                         $this->extend('augmentLoadLazyFields', $query, $dataQuery, $this);
  9.                         $this->extend('augmentSQL', $query, $dataQuery);
  10.  
  11.                         $dataQuery->setQueriedColumns($columns);
  12.                         $newData = $dataQuery->execute()->record();
  13.  
  14.                         // Load the data into record
  15.                         if($newData) {
  16.                                 foreach($newData as $k => $v) {
  17.                                         if (in_array($k, $columns)) {
  18.                                                 $this->record[$k] = $v;
  19.                                                 $this->original[$k] = $v;
  20.                                                 unset($this->record[$k . '_Lazy']);
  21.                                         }
  22.                                 }
  23.  
  24.                         // No data means that the query returned nothing; assign 'null' to all the requested fields
  25.                         } else {
  26.                                 foreach($columns as $k) {
  27.                                         $this->record[$k] = null;
  28.                                         $this->original[$k] = null;
  29.                                         unset($this->record[$k . '_Lazy']);
  30.                                 }
  31.                         }
  32.                 }
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement