Once we have defined the entities in the entities directory of the Flextrine server component it is very simple to create the appropriate database schema.
Creating the database schema
Browse to http://localhost/flextrinemanager (or whatever URL you pointed to the manager directory). You should see a screen like this:
Enter the URL of the Flextrine server side component (http://localhost/contacts) in the FLEXTRINE PROJECT URL input and Click to refresh. The Flextrine manager will examine your project and update the manager to show the entities and database. Now click on Create schema to automatically generate the appropriate tables in the database. The manager should now look like this:
Under the hood Doctrine 2 has parsed the annotations in ContactGroup and Contact and has determined the appropriate tables and columns that will be required to persist the objects. Although you will never need to edit the schema manually, the following SQL is what was actually executed when you clicked CREATE SCHEMA. Notice that Doctrine enforces referential integrity through MySQL constraints so that, for example, you cannot delete a ContactGroup which has any Contacts referring to it.
Now that the schema has been created you can use UPDATE SCHEMA whenever you add/remove entities or attributes within entities to update the schema without losing any data that is already in the database. This gives you a very efficient workflow as your entities expand over the lifetime of a project.
We now have everything we need in the Flextrine server side component and in the database. Its time to start writing some Flex code!