public function create_new(array $attributes = array())
    {
        $instance = null;

        if (!$this->is_collection) {
            $instance = new self::$custom_collections[$this->name]();
        } else {
            $instance = new Collection(array('table_name' => $this->name));
        }

        $instance->fill($attributes);

        // Fill '_id' if it's provided and in a trusted context
        if (isset($attributes['_id']) && Context::isTrusted()) {
            $instance->_id = $attributes['_id'];
        }

        return $instance;
    }
public function create_new(array $attributes = array())
    {
        $instance = null;

        if (!$this->is_collection) {
            $instance = new self::$custom_collections[$this->name]();
        } else {
            $instance = new Collection(array('table_name' => $this->name));
        }

        $instance->fill($attributes);

        // Fill '_id' if it's provided and in a trusted context
        if (isset($attributes['_id']) && Context::isTrusted()) {
            $instance->_id = $attributes['_id'];
        }

        return $instance;
    }
public function create_new ( array $ attributes = array ( ) ) { $ instance = null ; if ( ! $ this -> is_collection ) { $ instance = new self :: $ custom_collections [ $ this -> name ] ( ) ; } else { $ instance = new Collection ( array ( 'table_name' => $ this -> name ) ) ; } $ instance -> fill ( $ attributes ) ; // Fill '_id' if it's provided and in a trusted context if ( isset ( $ attributes [ '_id' ] ) && Context :: isTrusted ( ) ) { $ instance -> _id = $ attributes [ '_id' ] ; } return $ instance ; }
Create a new Collection instance. No database operations here.

@param  array             $attributes attributes
@return \Model\Collection
Create a new Collection instance . No database operations here .