Creating custom zf commands, such as zf create form

When I use the zend CLI to create a form, the form is created and added to the forms folder.

zf create form MyForm

I have a custom class that I would like to create a custom command for it in the same way and would like to see the command zf create formfor guidance. I suspected it was in Zend_Framework / bin, where there are shell files, php, bat, but I could not find any code related to creating the form class, maybe I missed it?

Anyway, is it better to do the same? How is the Zend API, which allows me to create some of these commands myself? If not for my only option, it would be to see how something like was created zf create form.

+3
source share
3 answers

At startup, zfit calls zf.phpin the bin folder. This, in turn, creates an instance Zend_Tool_Framework_Client_Consolethat jumps over some unobvious hoops to load all available actions and analyze your command. Part of this process involves searching the directory / Zend / Tool / Project / Provider /, which contains the classes responsible for providing many project-oriented actions (for example, creating forms).

I have never tried this myself, but there is (apparently somewhat outdated) documentation on creating your own suppliers , so I hope that after that you will point in the right direction.

+5
source

ZendCast Zend_Tool - Zend_Tool.

+4

You need to create a provider. Have a look at this nice tutorial: http://weierophinney.net/matthew/archives/242-Creating-Zend_Tool-Providers.html

+4
source

Source: https://habr.com/ru/post/1767651/


All Articles