Bananaapple
Bananaapple

Reputation: 3114

Is it possible to generate an entity and the corresponding table in a single command using symfony3 console

I am essentially looking to combine these two commands:

php bin/console doctrine:generate:entity --entity="BundleName:EntitiyName" --fields="fieldName:fieldType"

php bin/console doctrine:schema:update --force

I know I could write a script or simply chain the commands but I was wondering if Symfony provides an inbuilt solution.

I am using Symfony 3.3.

Upvotes: 0

Views: 43

Answers (1)

Bananaapple
Bananaapple

Reputation: 3114

So after looking into this some more this does not seem to be possible.

To work around this I created a batch script called tentity (table and entity), which I then added to my path:

@echo off
php .\bin\console doctrine:generate:entity %*
php .\bin\console doctrine:schema:update --force

Now I can simply do:

tentity --entity="BundleName:EntitiyName" --fields="fieldName:fieldType"

Upvotes: 0

Related Questions