Symfony2 Api-平台bin/schema 问题

Symfony2 Api-Platform bin/schema issue

我刚刚启动 Api-Platform 框架并在执行时:

php bin/schema generate-types src/ app/config/schema.yml

我明白了:

C:\wamp\www\sf2-api>php bin/schema generate-types src/ app/config/schema.yml

dir=$(d=${0%[/\]*}; cd "$d"; cd "../vendor/api-platform/schema-generator/bin" &
& pwd)

# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
        # Cygwin paths start with /cygdrive/ which will break windows PHP,
        # so we need to translate the dir path to windows format. However
        # we could be using cygwin PHP which does not require this, so we
        # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
        if [[ $(which php) == /cygdrive/* ]]; then
                dir=$(cygpath -m $dir);
        fi
fi

dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/schema" "$@"

我在 window7 上使用 Symfony 2.7.8。 我在 ubunbu 14.04 上遇到了同样的问题。

最后,我将 bin 目录替换为 blog-api 中的目录。

更新:

  • bin-api-platform 是由 api-platform 生成的。
  • bin-blog-api是我从blog-api复制过来的。这很好用。

使用:

php vendor/api-platform/schema-generator/bin/schema generate-types src/app/config/schema.yml  

而不是:

php bin/schema generate-types src/ app/config/schema.yml

正确的语法是:

php vendor/api-platform/schema-generator/bin/schema generate-types src/ app/config/schema.yml