8.2. Make Vendor Source

./script/solar make-vendor VendorName

The make-vendor command creates all the basic source files for a new vendor space inside a Solar system. The idea is, when you start a new project, you will use a new vendor space for the controllers, models, views, and other components of the application. You can have as many vendors as you like, so long as their names are different.

8.2.1. Example

To create a new vendor space inside a Solar system, issue the following command:

$ ./script/solar make-vendor VendorName
Making vendor source directories.
Creating SYSTEM/source/vendor-name/config.
Creating SYSTEM/source/vendor-name/docs.
Creating SYSTEM/source/vendor-name/script.
Creating SYSTEM/source/vendor-name/tests.
Creating SYSTEM/source/vendor-name/tests/Mock.
Creating SYSTEM/source/vendor-name/tests/Mock/VendorName.
Creating SYSTEM/source/vendor-name/tests/Test.
Creating SYSTEM/source/vendor-name/tests/Test/VendorName.
Creating SYSTEM/source/vendor-name/VendorName/Cli/Help.
Creating SYSTEM/source/vendor-name/VendorName/Cli/Help/Info.
Creating SYSTEM/source/vendor-name/VendorName/Cli/Help/Locale.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Bread/Locale.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Bread/Public.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Bread/View.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Command/Info.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Command/Locale.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/Layout.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/Locale.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/Public.
Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/View.
Creating SYSTEM/source/vendor-name/VendorName/Model.
Writing SYSTEM/source/vendor-name/VendorName/Cli/Help.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Cli/Help/Info/options.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/Locale/en_US.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/_item.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/_list.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/add.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/browse.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/delete.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/edit.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/read.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/search.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Command.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Controller/Page.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Filter.php ... done.
Making directory SYSTEM/source/vendor-name/VendorName/Sql ... done.
Writing SYSTEM/source/vendor-name/VendorName/Sql/Model.php ... done.
Making directory SYSTEM/source/vendor-name/VendorName/Sql/Model ... done.
Writing SYSTEM/source/vendor-name/VendorName/Sql/Model/Collection.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Sql/Model/Metadata.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Sql/Model/Record.php ... done.
Writing SYSTEM/source/vendor-name/config/default.php ... done.
Writing SYSTEM/source/vendor-name/config/run-tests.php ... done.
Writing SYSTEM/source/vendor-name/VendorName/Cli/Help/Info/help.txt ... done.
Making links for vendor 'VendorName' ...
    Making link 'include/VendorName' ... done.
    Making link 'include/Test/VendorName' ... done.
    Making link 'include/Mock/VendorName' ... done.
    Making link 'script/vendor-name' ... done.
... done.
Making public symlinks for 'VendorName' ...
    Making public directory docroot/public/VendorName/Controller ... done.
    Making public symlink for VendorName_Controller_Bread ... done.
    Making public symlink for VendorName_Controller_Page ... done.
... done.
Remember to add 'VendorName_App' to the ['Solar_Controller_Front']['classes'] element in your config file so that it finds your apps.
Remember to add 'VendorName_Model' to the ['Solar_Sql_Model_Catalog']['classes'] element in your config file so that it finds your models.
$

What is going on here?

  • The command creates a new source directory for vendor-name and adds some standard directories therein: config for default configuration files, docs for documentation files, script for the vendor-name command-line interface, tests for integration tests, and of course the VendorName directory for PHP classes.

  • The command creates a series of baseline classes and directories for VendorName PHP code: a minimal page controller, a boilerplace browse/read/edit/add/delete ("BREAD") controller, a base class for VendorName-specific models, directories for view helpers and concrete model classes, and so on.

  • Finally, the command creates symbolic links from the source directory to other locations in the Solar system, so that when source files change, you don't need to copy them out to the rest of the system.



Local