If a column-names array is passed, it will return a associative array
with the value of each column or null if it is not present.
public get ( $key ) |
/** * Add the optional last_topic column (only accessible if record_last_topic is true) * * @param string $column * @return mixed|ORM */ public function get($column) { if ($column == 'last_topic' && parent::get('location')->record_last_topic == 1) { return ORM::factory('Quill_Topic')->where('category_id', '=', $this->id)->order_by('updated_at', 'DESC')->limit(1)->find(); } return parent::get($column); }
public function get($column) { if (array_key_exists($column, $this->_object)) { return parent::get($column); } elseif (isset($this->_related[$column])) { // Return related model that has already been fetched return $this->_related[$column]; } elseif (isset($this->_belongs_to[$column])) { // Polymorphic relations if (Arr::get($this->_belongs_to[$column], 'polymorphic', FALSE) === TRUE) { $foreign_key = $this->polymorph_id(); $foreign_type = $this->polymorph_type(); $model = ORM::factory($this->_object[$foreign_type]); $col = $model->_object_name . '.' . $model->_primary_key; $val = $this->_object[$foreign_key]; } else { $model = $this->_related($column); // Use this model's column and foreign model's primary key $col = $model->_object_name . '.' . $model->_primary_key; $val = $this->_object[$this->_belongs_to[$column]['foreign_key']]; } // Make sure we don't run WHERE "AUTO_INCREMENT column" = NULL queries. This would // return the last inserted record instead of an empty result. // See: http://mysql.localhost.net.ar/doc/refman/5.1/en/server-session-variables.html#sysvar_sql_auto_is_null if ($val !== NULL) { $model->where($col, '=', $val)->find(); } return $this->_related[$column] = $model; } else { return parent::get($column); } }
public function get($col) { if ($col == $this->_created_column['column']) { return date(Kohana::$config->load('quill.time_format'), parent::get($col)); } return parent::get($col); }
/** * Getter method, allows $model->get('property') access to data * * @param string $property * @return string */ public function get($property) { return $this->orm->get($property); }
if ($_REQUEST[lti_launch_id]) { $launchid = $_REQUEST[lti_launch_id]; } else { if (!empty($_SESSION['lti_launch_id'])) { $launchid = $_SESSION[lti_launch_id]; } else { unset($_SESSION['lti_launch_id']); redirect_login(); $launchid = false; } } if ($launchid) { $launch = new ORM("launch", false, "lti_launch"); if (!$launch) { throw new Exception("LTI Runtime - Datebase unable to instance user"); } $launch->get($launchid); if (!$launch->id()) { throw new Exception("LTI Runtime - Launch session not found"); } $launchdata = $launch->data(); $_SESSION['lti_launch_id'] = $launch->id(); if ($launch && $launch->data()) { $LTI = new LTIObject($launch->data()); } } } catch (Exception $e) { DPRT($e->getMessage()); redirect_login(); $LTI = false; }