Thursday, April 5, 2012

Doctrine CLI

Got it!

Apparently Dreamhost's PHP CLI uses version 5.2.17.  I needed it to use 5.3, so any commands must be preceeded with /usr/local/php53/bin/php

I was thrown off by the instruction's to change the APPPATH definition.  After a great deal of trial and error, it turned out that define('APPPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); was what I needed.

[yangon]$ /usr/local/php53/bin/php doctrine-cli.php  

Returned the expected results.  Huzzah!

I tried running php doctrine-cli.php orm:generate-entities models

but it gave me an error - 

  [Doctrine\ORM\Mapping\MappingException]                                       
  No mapping file found named 'Entities.Article.dcm.yml' for class 'Entities\Article'.

I setup my own Entities xml file, after a little trial and error I saw that this was the problem, so I replaced that with the yml files from Joel's documentation.  Now that command works.

[yangon]$ /usr/local/php53/bin/php doctrine-cli.php orm:generate-entities models
Processing entity "Entities\Article"
Processing entity "Entities\User"
Entity classes generated to "/home/xxxjermxxx/dixieandtheninjas.net/hellounderscoreworld/applicationFolder/models"

Yay!

Now php doctrine-cli.php orm:generate-proxies

Fatal error: Call to undefined function Doctrine\Common\Cache\apc_fetch() in /home/xxxjermxxx/dixieandtheninjas.net/hellounderscoreworld/applicationFolder/libraries/Doctrine/Common/Cache/ApcCache.php on line 52
After some digging, it appears that I do not have APC installed (alternate PHP cache). The comments on Joel's page recommends either disabling APC or installing it. Installing it has proved a little tricky.


http://wiki.dreamhost.com/APC

[a little while later...]

APC installed!


[yangon]$ /usr/local/php53/bin/php doctrine-cli.php orm:generate-proxies
Processing entity "Entities\Article"
Processing entity "Entities\User"
Proxy classes generated to "/home/xxxjermxxx/dixieandtheninjas.net/hellounderscoreworld/applicationFolder/models/Proxies"


Progress!


[yangon]$ /usr/local/php53/bin/php doctrine-cli.php orm:schema-tool:create
ATTENTION: This operation should not be executed in a production environment.
Creating database schema...
Database schema created successfully!


Aaaaaaaand apparently its done.  Installed.

Now I'll wrap this post up and next time we'll see what happens when we try to do stuff with it!

No comments:

Post a Comment