31,003
edits
| Line 64: | Line 64: | ||
Once you have created your tables into the database, move to the dev/skeletons directory and run the script | Once you have created your tables into the database, move to the dev/skeletons directory and run the script | ||
<pre>php build_class_from_table.php | <pre>php build_class_from_table.php tablename</pre> | ||
Note: If the command does not work, try to use php-cli php instead. | Note: If the command does not work, try to use php-cli php instead. | ||
This will generate a file '''out. | This will generate a file '''out.tablename.class.php''' that contains the class to manage table tablename. | ||
In this class, you can find the CRUD methods (Create / Read / Update / Delete) already working to do an insert, a fetch (select), an update, a delete of a row in table. | In this class, you can find the CRUD methods (Create / Read / Update / Delete) already working to do an insert, a fetch (select), an update, a delete of a row in table. | ||
Remove just the "out" from the file name and put the file in a subdirectory of '''htdocs''' specific to your module (in htdocs/mymodule for example). | Remove just the "out" from the file name and put the file in a subdirectory of '''htdocs''' specific to your module (in htdocs/mymodule for example). | ||
A file '''out. | A file '''out.tablename_script.php''' has been generated and contains a sample code to use the class for each of the 4 CRUD methods. | ||
= Ajouter vos onglets sur les fiches entités (optionnel) = | = Ajouter vos onglets sur les fiches entités (optionnel) = | ||