我如何知道我正在运行哪个版本的 Doctrine?
已经将它与 CodeIgniter 一起使用了一段时间,我不记得我是否安装了 v2 或者只是从另一个项目复制了文件。
有什么想法吗?
Have been using it for a while with CodeIgniter and I can't remember if I installed v2 or just copied the files from another project.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
查看文件
vendor/doctrine/orm/lib/Doctrine/ORM/Version.php
,其中有一个常量显示版本。也可以从正在运行的应用程序访问它,但这更容易。Check out the file
vendor/doctrine/orm/lib/Doctrine/ORM/Version.php
, there is a constant in there that shows the version. It's also accessible from a running app but this is easier.如果您使用 Composer 来处理项目的依赖项,那么您应该尝试使用:
OR
输出将类似于:
If you are using the composer to handle dependencies on your project, then you should try with:
OR
And the output will be something like:
在我的 symfony2 和 symfony3 项目中,找到正确 Version.php 文件(第 39 行)的路径是:
Within my symfony2 and symfony3 project, the path to find the correct Version.php file, line 39, was:
core.php:
core.php
:对于 Windows 用户:
在您的 symfony2 项目中:
查找类似以下内容:
For Windows users:
Within your symfony2 project:
look for something like:
如果您使用 PATH 作为其可执行文件安装了 Composer,则可能会收到 Composer.phar 不存在的错误。
这对我有用:
%composer show --installed | grep "doctrine/orm"
您应该得到显示版本号的输出:
请注意,您不需要
| grep
部分;如果删除它,您将在项目中看到 Composer 中安装的所有内容。您可以改为使用| grepdoctrine
查看所有与 Doctrine 相关的已安装软件包版本。If you have composer installed using your PATH for its executable, you may get an error that composer.phar doesn't exist.
This works for me:
% composer show --installed | grep "doctrine/orm"
You should get output showing the version number:
Note that you don't need the
| grep
part; if you remove that, you'll see all installed things from composer in the project. You can instead use| grep doctrine
to see all Doctrine-related installed package versions.对于 Doctrine 版本 1.* 打开文件 /doctrine/Doctrine/Core.php
应该在开头看到版本号。
For Doctrine version 1.* open file /doctrine/Doctrine/Core.php
Should see version number at the begging.