-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a code generation package #24
Comments
I've been thinking of a rough design of how Oil ought to work, with some means of templating the generated code. Let's say we have an OilMain class that is invoked via a PHP-CLI and loads its config. It can then create an instance of the command class (we would have a class for generte, refine etc.), set the parameters and call execute(). For generate, specifically, we can have a DbSchema class that fetches the database schema using a helper for each DB, possibly using the query builder. With the schema, the GenerateCommand object can then make a call to the template engine by setting the data and calling render() on it. ---BEGIN illustration OilMain Command (GenerateCommand, ...) DbSchema TemplateEngine ---END illustration I've been toying with the idea of using something like Smarty as a template engine, though that would need some more investigation on my part. Also, if we choose to make oil function independently of Fuel, our DB queries can be generated by the helpers rather than through the query builder. Perhaps we can abstract it out later to get Fuel to use it, if needed, as it is a subset of the functionality of Fuel's query builder. |
Looks like a good start but it seems like you are focusing too much on the tasks themselves rather than oil itself. The first step needs to be being able to run specific tasks via a cli. The oil package does not need to be tied to any other fuel package. The tasks themselves can be provided by other fuel packages, so the scaffold creation by the DB or Orm package. |
Something serious needs to be done about the commandline as well. It's rather stupid to try to specify everything you need on a single line, things like
I think it would be a lot better if you could have some sort of interactive shell, in which you could type in commands like |
This would be very nice. It's such a pain to have to enter a massive long string and also allows errors in input to be handled better. |
This package will contain the code generation (scaffolding) code of the 1.x Oil package.
It should have a pluggable architecture, so that external components can add extra features to it. For example the ORM package could provide the generators for ORM models.
The text was updated successfully, but these errors were encountered: