public function getSchema(Connection $connection)
    {
        if (!method_exists($connection, 'schemaCollection')) {
            throw new RuntimeException('The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.');
        }

        $config = $connection->config();
        if (empty($config['cacheMetadata'])) {
            $connection->cacheMetadata(true);
        }

        return $connection->getSchemaCollection();
    }
public function getSchema(Connection $connection)
    {
        if (!method_exists($connection, 'schemaCollection')) {
            throw new RuntimeException('The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.');
        }

        $config = $connection->config();
        if (empty($config['cacheMetadata'])) {
            $connection->cacheMetadata(true);
        }

        return $connection->getSchemaCollection();
    }
public function getSchema ( Connection $ connection ) { if ( ! method_exists ( $ connection , 'schemaCollection' ) ) { throw new RuntimeException ( 'The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.' ) ; } $ config = $ connection -> config ( ) ; if ( empty ( $ config [ 'cacheMetadata' ] ) ) { $ connection -> cacheMetadata ( true ) ; } return $ connection -> getSchemaCollection ( ) ; }
Helper method to get the schema collection.

@param \Cake\Database\Connection $connection Connection object
@return \Cake\Database\Schema\Collection|\Cake\Database\Schema\CachedCollection
@throws \RuntimeException If given connection object is not compatible with schema caching
Helper method to get the schema collection .