( ZN >= 4.0.0 )
# Section Headings
Use the Generate :: grandVision () method to transform your tables into model files . After running this method, model files are added into the Models / Visions / directory. How to use the specified method is described in the Generate Library section. Vision takes the last occurrence while creating the Vision files .
|Array||$ databases = NULL||If this value is not specified, all databases are considered.|
If some of the databases contain different settings, you can use them as follows.
Generate::grandVision(['db' => ['user' => 'user', 'password' => 'pass'], 'otherdb']);
php zerocore run-class generate:grandvision current_database other_database
With the code above, the current_database and other_database databases have been turned into grand vision model files.
Models/Visions/ -> Current_database/ -> InternalUserVision.php -> InternalProductVision.php -> Other_database/ -> InternalOther_databaseUserVision.php -> InternalOther_databaseProductVision.php
In the above directory view it is shown that a directory is created for each database and a file is created in the tables belonging to that database. Vision models for the default database setting do not take the database prefix, while other databases take the prefix from the table name first. Also all vision models take Vision last add.
To use the vision files in the example above;
output( UserVision::result() ); output( ProductVision::result() ); output( Other_databaseUserVision::result() ); output( Other_databaseProductVision::result() );
. Note that the table prefix for the default database is not fetched, but the database name is prefixed for the other database. The last element of Vision is used to recognize that the class being used is the vision model and not to conflict with other libraries of the same name . These model files created use the methods of extending GrandModel .
Use the Generate :: deleteVision () method to delete the vision files .
|Array||$ databases = '*'||Which databases will be deleted. The default * will delete all visions if used.|
|Array||$ tables = NULL||Which tables will be erased.|
Generate::deleteVision(); // Deleted All
You can use the following to delete the specified tables of a database.
Generate::deleteVision('ExampleDB', ['blog', 'comments']);
php zerocore run-class generate:deletevision
php zerocore run-class generate:deletevision exampledb