original_string: protected function _reflect($stage, $name, $config, $schema)
      {
          $describeMethod = "describe{$stage}Sql";
          $convertMethod = "convert{$stage}Description";
  
          list($sql, $params) = $this->_dialect->{$describeMethod}($name, $config);
          if (empty($sql)) {
              return;
          }
          try {
              $statement = $this->_connection->execute($sql, $params);
          } catch (PDOException $e) {
              throw new Exception($e->getMessage(), 500, $e);
          }
          foreach ($statement->fetchAll('assoc') as $row) {
              $this->_dialect->{$convertMethod}($schema, $row);
          }
          $statement->closeCursor();
      }
code: protected function _reflect($stage, $name, $config, $schema)
      {
          $describeMethod = "describe{$stage}Sql";
          $convertMethod = "convert{$stage}Description";
  
          list($sql, $params) = $this->_dialect->{$describeMethod}($name, $config);
          if (empty($sql)) {
              return;
          }
          try {
              $statement = $this->_connection->execute($sql, $params);
          } catch (PDOException $e) {
              throw new Exception($e->getMessage(), 500, $e);
          }
          foreach ($statement->fetchAll('assoc') as $row) {
              $this->_dialect->{$convertMethod}($schema, $row);
          }
          $statement->closeCursor();
      }
code_tokens: protected function _reflect ( $ stage , $ name , $ config , $ schema ) { $ describeMethod = "describe{$stage}Sql" ; $ convertMethod = "convert{$stage}Description" ; list ( $ sql , $ params ) = $ this -> _dialect -> { $ describeMethod } ( $ name , $ config ) ; if ( empty ( $ sql ) ) { return ; } try { $ statement = $ this -> _connection -> execute ( $ sql , $ params ) ; } catch ( PDOException $ e ) { throw new Exception ( $ e -> getMessage ( ) , 500 , $ e ) ; } foreach ( $ statement -> fetchAll ( 'assoc' ) as $ row ) { $ this -> _dialect -> { $ convertMethod } ( $ schema , $ row ) ; } $ statement -> closeCursor ( ) ; }
docstring: Helper method for running each step of the reflection process.
  
  @param string $stage The stage name.
  @param string $name The table name.
  @param array $config The config data.
  @param \Cake\Database\Schema\TableSchema $schema The table instance
  @return void
  @throws \Cake\Database\Exception on query failure.
docstring_tokens: Helper method for running each step of the reflection process .