src/Titon/Db/Repository.php
public function castResults(Event $event, array &$results, $finder) {
        $columns = $this->getSchema()->getColumns();
        $driver = $this->getDriver();
        $entityClass = $this->getEntity();

        foreach ($results as $i => $result) {
            foreach ($result as $field => $value) {
                if (isset($columns[$field])) {
                    $result[$field] = $driver->getType($columns[$field]['type'])->from($value);
                }

                if (!is_array($value)) {
                    continue;
                }

                $result[$field] = new Entity($value);
            }

            $results[$i] = new $entityClass($result);
        }
    }
public function castResults(Event $event, array &$results, $finder) {
        $columns = $this->getSchema()->getColumns();
        $driver = $this->getDriver();
        $entityClass = $this->getEntity();

        foreach ($results as $i => $result) {
            foreach ($result as $field => $value) {
                if (isset($columns[$field])) {
                    $result[$field] = $driver->getType($columns[$field]['type'])->from($value);
                }

                if (!is_array($value)) {
                    continue;
                }

                $result[$field] = new Entity($value);
            }

            $results[$i] = new $entityClass($result);
        }
    }
public function castResults ( Event $ event , array & $ results , $ finder ) { $ columns = $ this -> getSchema ( ) -> getColumns ( ) ; $ driver = $ this -> getDriver ( ) ; $ entityClass = $ this -> getEntity ( ) ; foreach ( $ results as $ i => $ result ) { foreach ( $ result as $ field => $ value ) { if ( isset ( $ columns [ $ field ] ) ) { $ result [ $ field ] = $ driver -> getType ( $ columns [ $ field ] [ 'type' ] ) -> from ( $ value ) ; } if ( ! is_array ( $ value ) ) { continue ; } $ result [ $ field ] = new Entity ( $ value ) ; } $ results [ $ i ] = new $ entityClass ( $ result ) ; } }
Type cast the results and wrap each result in an entity after a find operation.

@param \Titon\Event\Event $event
@param array $results
@param string $finder
Type cast the results and wrap each result in an entity after a find operation .