[英]symfony OAuth2 Validation failed: no DTD found
i use this tutorial http://blog.tankist.de/blog/2013/07/17/oauth2-explained-part-2-setting-up-oauth2-with-symfony2-using-fosoauthserverbundle/ 我使用本教程http://blog.tankist.de/blog/2013/07/17/oauth2-explained-part-2-setting-up-oauth2-with-symfony2-using-fosoauthserverbundle/
i have error 我有错误
php app/console doctrine:schema:update --dump-sql
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Cannot import resource "/home/miejsce/public_html/src/Acme/DemoBundle/Resources/config/services.xml" from "/home/miejsce/public_html/app/config
/config.yml". (Unable to parse file "/home/miejsce/public_html/src/Acme/DemoBundle/Resources/config/services.xml".)
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to parse file "/home/miejsce/public_html/src/Acme/DemoBundle/Resources/config/services.xml".
[InvalidArgumentException]
[ERROR 94] Validation failed: no DTD found ! (in n/a - line 2, column 12)
[ERROR 5] Extra content at the end of the document (in n/a - line 7, column 1)
services.xml fils is copy and paste from manual here is source services.xml fils是从手册中复制粘贴的,这里是源
<!-- src/Acme/DemoBundle/Resources/config/services.xml -->
<parameters>
<parameter key="platform.entity.user.class">Acme\DemoBundle\Entity\User</parameter>
<parameter key="platform.user.provider.class">Acme\DemoBundle\Provider\UserProvider</parameter>
</parameters>
<services>
<service id="platform.user.manager" class="Doctrine\ORM\EntityManager"
factory-service="doctrine" factory-method="getManagerForClass">
<argument>%platform.entity.user.class%</argument>
</service>
<service id="platform.user.repository"
class="Acme\DemoBundle\Repository\UserRepository"
factory-service="platform.user.manager" factory-method="getRepository">
<argument>%platform.entity.user.class%</argument>
</service>
<service id="platform.user.provider" class="%platform.user.provider.class%">
<argument type="service" id="platform.user.repository" />
</service>
</services>
only one diffrence i make from manual - i add 我与手册仅存在一个差异-我添加
imports: ** - { resource: @AcmeDemoBundle/Resources/config/services.xml } 导入:**-{资源:@ AcmeDemoBundle / Resources / config / services.xml}
to config.yml is need i think 我认为需要config.yml
where i can have error ? 我在哪里可以出错?
UPDATE1 UPDATE1
i revrite config to yml now have 我将配置修改为yml
parameters:
platform.entity.user.class: Acme\DemoBundle\Entity\User
platform.user.provider.class: Acme\DemoBundle\Provider\UserProvider
services:
platform.user.manager:
class: "%doctrine.entity_managers%"
factory_service: doctrine
factory_method: getManagerForClass
arguments:
- "%platform.entity.user.class%"
platform.user.repository:
class: Acme\DemoBundle\Repository\UserRepository
factory_service: platform.user.manager
factory_method: getRepository
arguments:
- "%platform.entity.user.class%"
platform.user.provider:
class: "%platform.user.provider.class%"
arguments:
- "@platform.user.repository"
sory still is error : 很抱歉仍然是错误的:
php app/console doctrine:schema:update --force
PHP Warning: DOMElement::setAttribute() expects parameter 2 to be string, array given in /home/miejsce/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php on line 117
PHP Warning: strpos() expects parameter 1 to be string, array given in /home/miejsce/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php on line 508
PHP Notice: Array to string conversion in /home/miejsce/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php on line 508
PHP Notice: Array to string conversion in /home/miejsce/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php on line 508
Nothing to update - your database is already in sync with the current entity metadata.
When i run i get succes: 当我运行时,我会成功:
php app/console acme:oauth-server:client:create --redirect-uri="http://clinet.local/" --grant-type="authorization_code" --grant-type="password" --grant-type="refresh_token" --grant-type="token" --grant-type="client_credentials"
Added a new client with public id 3_4gn1mzg8lnackso0s8c0o0gk004sgkog4000o4gg8ss4s40g4, secret 6bq5vs50kuossgs08ccsgskwc0ow4ssosw8k084cgk0w0wo8cg
but on page 但在页面上
FatalErrorException: Compile Error: Cannot redeclare class Acme\\DemoBundle\\SecurityController in /home/miejsce/public_html/src/Acme/DemoBundle/Controller/SecurityController.php line 0 FatalErrorException:编译错误:无法在/home/miejsce/public_html/src/Acme/DemoBundle/Controller/SecurityController.php第0行中重新声明类Acme \\ DemoBundle \\ SecurityController
You are trying to import an XML services file from a YML config file. 您正在尝试从YML配置文件导入XML服务文件。 The YML reader follows the import and tries to parse the XML which gives an error. YML阅读器遵循导入并尝试解析XML,这会导致错误。
Why do you need to do that import? 为什么需要导入? If it is really needed maybe you cant try to rewrite the XML services config in YML 如果确实需要,可能您无法尝试在YML中重写XML服务配置
Please use reference implementation for this blog article to troubleshoot troubles like this. 请使用此博客文章的参考实现来解决此类问题。
The file you are interested in is here: https://github.com/iamtankist/oauth-server/blob/master/src/StarkIndustries/IronWallBundle/Resources/config/services.xml 您感兴趣的文件在这里: https : //github.com/iamtankist/oauth-server/blob/master/src/StarkIndustries/IronWallBundle/Resources/config/services.xml
Reference implementation all together: https://github.com/iamtankist/oauth-server 一起参考实施: https : //github.com/iamtankist/oauth-server
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.