Tool::loadSchemaFile PHP Method

loadSchemaFile() public method

スキーマファイルを読み込む
public loadSchemaFile ( array $data, string $tmpPath ) : boolean
$data array
$tmpPath string
return boolean
    public function loadSchemaFile($data, $tmpPath)
    {
        $path = $tmpPath . $data['Tool']['schema_file']['name'];
        if (move_uploaded_file($data['Tool']['schema_file']['tmp_name'], $path)) {
            include $path;
            $schemaName = basename(Inflector::classify(basename($path)), '.php') . 'Schema';
            $Schema = new $schemaName();
            $db = ConnectionManager::getDataSource($Schema->connection);
            if ($db->loadSchema(array('type' => $data['Tool']['schema_type'], 'path' => $tmpPath, 'file' => $data['Tool']['schema_file']['name']))) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }