src/Charcoal/Loader/CollectionLoader.php
protected function processModel($objData, callable $before = null, callable $after = null)
    {
        if ($this->dynamicTypeField && isset($objData[$this->dynamicTypeField])) {
            $objType = $objData[$this->dynamicTypeField];
        } else {
            $objType = get_class($this->model());
        }

        $obj = $this->factory()->create($objType);

        if ($before !== null) {
            call_user_func_array($before, [ &$obj ]);
        }

        $obj->setFlatData($objData);

        if ($after !== null) {
            call_user_func_array($after, [ &$obj ]);
        }

        return $obj;
    }
protected function processModel($objData, callable $before = null, callable $after = null)
    {
        if ($this->dynamicTypeField && isset($objData[$this->dynamicTypeField])) {
            $objType = $objData[$this->dynamicTypeField];
        } else {
            $objType = get_class($this->model());
        }

        $obj = $this->factory()->create($objType);

        if ($before !== null) {
            call_user_func_array($before, [ &$obj ]);
        }

        $obj->setFlatData($objData);

        if ($after !== null) {
            call_user_func_array($after, [ &$obj ]);
        }

        return $obj;
    }
protected function processModel ( $ objData , callable $ before = null , callable $ after = null ) { if ( $ this -> dynamicTypeField && isset ( $ objData [ $ this -> dynamicTypeField ] ) ) { $ objType = $ objData [ $ this -> dynamicTypeField ] ; } else { $ objType = get_class ( $ this -> model ( ) ) ; } $ obj = $ this -> factory ( ) -> create ( $ objType ) ; if ( $ before !== null ) { call_user_func_array ( $ before , [ & $ obj ] ) ; } $ obj -> setFlatData ( $ objData ) ; if ( $ after !== null ) { call_user_func_array ( $ after , [ & $ obj ] ) ; } return $ obj ; }
Process the raw data for one model.

@param  mixed         $objData The raw dataset.
@param  callable|null $before  Process each entity before applying raw data.
@param  callable|null $after   Process each entity after applying raw data.
@return ModelInterface|ArrayAccess|null
Process the raw data for one model .