ORM::as_array PHP Метод

as_array() публичный Метод

Return the raw data wrapped by this ORM instance as an associative array. Column names may optionally be supplied as arguments, if so, only those keys will be returned.
public as_array ( )
    public function as_array()
    {
        if (func_num_args() === 0) {
            return $this->_data;
        }
        $args = func_get_args();
        return array_intersect_key($this->_data, array_flip($args));
    }

Usage Example

Пример #1
0
 /**
  * Returns an array of all the '_col' members. The keys will be the name
  * of the member with the '_col' chopped off the end.
  *
  * @todo update to work with $this->_orm
  * @return array
  */
 public function as_array()
 {
     if ($this->_orm) {
         $data = $this->_orm->as_array();
     } else {
         $data = array();
         foreach ($this as $key => $val) {
             if (substr($key, -4) == '_col' && $val) {
                 $data[substr($key, 0, -4)] = $val;
             }
         }
     }
     return $data;
 }
All Usage Examples Of ORM::as_array
ORM