Doctrine 2 cli Shortcut

95 views Asked by At

I am integrating Doctrine 2 in my current CodeIgniter 3 project In command-line,when using doctrine command, for example creating database schema from an entity I usually do this.

$ ./application/vendor/bin/doctrine orm:schema-tool:create

Is it possible to create a shortcut for it so that in command line, instead of typing the whole path,

$ ./application/vendor/bin/doctrine orm:schema-tool:create

I will just type

$ doctrine orm:schema-tool:create,

if possible, any ideas on how to do this?

I tried this code

export  PATH=${PATH}:/application/vendor/bin/doctrine

Doesn't work.Any Ideas?

1

There are 1 answers

0
Tomas Votruba On

The code you aim to type is still too long to be practical. I'd recommend using shell aliases, e.g.:

alias dud='php bin/console orm:schema-tool:update --dump-sql'
alias duf='php bin/console orm:schema-tool:update --force'

Then I just run:

dud

And entities <=> database diff is shown. Then if everything works, I update the database by:

duf