Hi I'm on Symfony 5 and I'll like to generate php entities and update the scheme from a orm.xml file.
I think it worked before with doctrine:generate:entities command.
Any solution? Thanks in advance
The command doctrine:generate:entities was removed. The Doctrine ORM team does not encourage creating entities from existing schema and therefore deprecated that functionality in the ORM.
With the MakerBundle you can create entities, but as far as I know it won't create them from a schema, so you have to manually create each Entity, which admittedly can be annoying if you just want to generate them based on the existing schema anyway. Alternatively you can create a new "legacy" Symfony application (e.g. based on version 3.4 as this should still have the command), create the entities from the schema as described in the docs, and then copy the generated entities over into your project. You will likely also have to run a search & replace for AppBundle\Entity -> App\Entity.
I found this solution for a problem I have: how to generate entities with JPA annotations from a given database.
IntelliJ IDEA 10 generate entity (POJO) from DB model
Now with IntelliJ I'm given the possibility to create relationships between entities manually. Is there a way to generate them automatically as it did with entities?
I used the REFERENCES keyword when needed while creating the database. I suppose there should be an automatic mapping of relationships as well!
When Generating entities from DB Schema in dialog there is an option to 'Show default relationships' which when selected will display FK relationships when selecting tables to generate entities from:
We are developing an application which uses multiple schemas to manage database objects.
I cannot see anyway of doing this with Liquibase.
I had to drop schemas manually and create them.
dropAll gradle task only drops objects in public schema.
Any help would be great.
Thanks for your time.
Liquibase can handle objects within multiple schemas and can also manage creating additional schemas as well.
When you connect to the database, Liquibase will create a DATABASECHANGELOG table in the default schema and that schema needs to exist. That table tracks which changeSets have executed, and anything that can be done through SQL can be done within your changeSets.
There are built-in tags for things like createTable, addColumn etc which will make changes in the default schema, but they all have tags such as tableSchemaName that can be used to target the object to a different schema.
If you want to make changes for which there are not built-in tags, you can always use the "sql" tag and specify whatever sql you want, such as create database additional_info
I have a mysql database with tables that have one to many relationships with foreign keys linking them.
How can I use gii to create CRUD form pages which will reflect the table relationships?
I suggest you to take a look at the following article which includes using yii's gii
Creating Your First Yii Application
i am starting to use Yii framework and the gii tool to create the crud functionality for several tables.
The issue is that i need normally to modify the generated code. For example, i have noticed that all the forms use only text inputs. For example, in the case of foreign keys i need to show a select where the user can select a register of the other table without having to insert the primary key.
I achive this modifying the involved views (_view.php, _form.php, ...). My problem starts when it's necessary to modify the database and regenerate the code again. For that case i would have to go table by table, updating the involved files one by one keeping my old changes.
Does it exist a way to deal better with this situation?
The GiiX extension generates dropdowns for relationships.
In case you use the Gii Model generation, GiiX generates better models, too.
You don't have to do that. You can generate a select with the foreign keys, for example.
<?php echo CHtml::dropDownList('ModelName[language_id]',$model->language_id,CHtml::listData(Language::model()->findAll(), 'id', 'name'), array('prompt'=>'Select Language')); ?>
The first parameter is the name of the select, second is the value (if you're updating, the value will be selected), third is the data, and the fourth is an array with html options. More info about CHtml::dropDownList and CHtml::listData.
In this, the language_id is the foreign key, and in the Language table you have an id and a name field. This will generate a select with all the available languages, like this : 1=> English, 2=> German etc.
If you're going to need the functionality of crud form generation a couple of times, with the option of show foreign keys as dropdowns, you can create your own gii template to do it for you. Take a look at the guide to know how to do it.
For this functionality you need to develop you gii tool which will inherit functionality of existing gii tool, means some modification in existing classes while creating CRUD. This is your specific requirement, gii tool provides only general functionality which suits to all users.