25

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?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
slugmandrew
  • 1,776
  • 2
  • 25
  • 45

7 Answers7

49

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.

Jaime Roman
  • 749
  • 1
  • 11
  • 26
Chuck Vose
  • 4,560
  • 24
  • 31
41

If you are using the composer to handle dependencies on your project, then you should try with:

php composer.phar show --installed

OR

php composer.phar show -i | grep doctrine

And the output will be something like:

doctrine/annotations                     v1.1.2             Docblock Annotations Parser
doctrine/cache                           v1.3.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                     v1.2               Collections Abstraction library
doctrine/common                          v2.4.1             Common Library for Doctrine projects
doctrine/data-fixtures                   v1.0.0             Data Fixtures for all Doctrine Object Managers
doctrine/dbal                            2.3.4              Database Abstraction Layer
doctrine/doctrine-bundle                 v1.2.0             Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle        v2.2.0             Symfony DoctrineFixturesBundle
doctrine/inflector                       v1.0               Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer                           v1.0               Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                             2.3.5              Object-Relational-Mapper for PHP
Francesco Casula
  • 26,184
  • 15
  • 132
  • 131
  • `php composer.phar show --installed` gave error `Could not open input file: composer.phar` (I ran it from the repo top-level folder). I had to run `composer show --installed | grep doctrine`. – SteveExdia Jun 09 '21 at 14:41
8

Within my symfony2 and symfony3 project, the path to find the correct Version.php file, line 39, was:

Vendor/doctrine/orm/lib/Doctrine/ORM/Version.php

Braian Mellor
  • 1,934
  • 3
  • 31
  • 50
Jlappano
  • 147
  • 3
  • 8
6

core.php:

class Doctrine_Core
{
    /**
     * VERSION
     */
    const VERSION                   = '1.2.4';

...
firedev
  • 20,898
  • 20
  • 64
  • 94
  • Thanks, for those who want to find core.php, you can check in you project source or in your symfony default installation: ...\php5\PEAR\symfony\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine – xtrm Jun 07 '13 at 10:14
5

For Windows users:

Within your symfony2 project:

\vendor\doctrine\orm\lib\Doctrine\ORM\Version.php

look for something like:

/**
 * Current Doctrine Version
 */
const VERSION = '2.4.6';
Link
  • 51
  • 3
  • 4
1

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:

You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.
doctrine/orm                             v2.5.14 Object-Relational-Mapper for PHP

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.

SteveExdia
  • 321
  • 1
  • 3
  • 11
0

For Doctrine version 1.* open file /doctrine/Doctrine/Core.php

Should see version number at the begging.

Johanes
  • 11
  • 4