OpenSource For You

Location of files

-

explained. It is imperative to remember that duplicate table QDPHs DFURss GDWDEDsHs DGGHG WR WhH FRQfiJXUDW­LRQ ZRXOG UDLsH D warning because the two tables would get duplicate class names during Codegen. Typically, Codegen will raise an error when sXFh LssXHs DULsH. 7R FRXQWHU WhLs, sHW SUHfix DQG/RU sXIfix YDOXHs for classNames in codegen_settings.xml for the database whose 250 FODss fiOHs yRX ZRXOG ZDQW WR FDUUy WhH SUHfix/sXIfix. 7hH ORFDWLRQ RI fiOHs JHQHUDWHG GXULQJ WhH CRGHJHQ SURFHss GHSHQGs RQ WhH WySH RI fiOH. HHUH Ls D OLsW RI ORFDWLRQs ZhHUH WhH CRGHJHQHG fiOHs DUH sWRUHG: 1. includes/meta_controls/generated/: 7hH fiOHs LQ WhLs directory contain the actual code for MetaContro­ls and DataGrids (in MetaContro­l-Gen and DataGrid-Gen classes) and are overwritte­n each time Codegen runs. They should not be used to store any custom logic for the generated MetaContro­ls and DataGrids. includes/meta_controls/: This directory will contain the FODss fiOHs ZhHUH yRX FDQ ZULWH yRXU FXsWRP ORJLF IRU WhH MetaContro­ls and DataGrids because they are created once and are not overwritte­n on subsequent code generation­s. These are directly derived from the MetaContro­lGen classes. includes/model/generated/: CRQWDLQs 250-GHQ FODss fiOHs for each table with the functions we discussed earlier. They are overwritte­n on subsequent code generation­s and these too cannot hold any custom code you write in them. includes/model/: CRQWDLQs WhH 250 FODss fiOHs WhDW yRX should use while designing your applicatio­n. They are not overwritte­n and are one great place to store your custom methods for each table separately! includes/formbase_classes_generated/: Contains the abstract classes to derive from, for creating pages to list and edit entries in tables, updated on each Codegen run. drafts/panels/: Contains Codegened panels that can be directly used for creating, editing and deleting entries in tables. They use MetaContro­ls for the respective tables and add the ‘Save’, ‘Cancel’ and ‘Delete’ buttons for CRUD functional­ity. These panels are reusable in your applicatio­n, and are recreated on each Codegen. drafts/: Contains individual pages for CRUD functional­ity for tables. They are overwritte­n each time Codegen runs. In addition to the files created to work upon tables, the QCubed Codegen system also updates three special files located in includes/model/generated. The files are: _class_ paths.inc.php, _type_class_paths.inc.php and QQN.class.php. These files are vital to the autoloadin­g feature in QCubed, and must not be tampered with.

5.

6.

7. 'R QRW HYHU DOWHU DQy fiOHs ZhLFh DUH RYHU-ZULWWHQ RQ Codegen. You would only lose your work. UsH 250 FODss fiOHs WR ZULWH DQy FRGH WhDW ZRUNs RQ WDEOH data directly. This will facilitate organisati­on of code, and UHGXFH WhH QXPEHU RI FXsWRP fiOHs yRX QHHG WR FUHDWH; H.J., LI you want to create a method that loads objects using a nonLQGHxHG FROXPQ, WhH 250 FODss Ls ZhHUH yRX shRXOG GHfiQH LW. Choose drafts pages and the AJAX panel over phpPgAdmin (or phpMyAdmin) for inputting data—they are safer and come with validation logic. If you want to show a control on your Web page, which directly relates to a table in the DB, try to use MetaContro­ls rather than creating a new control, time and again. You can alter the looks and behaviour of input controls you get via MetaContro­ls. If you alter the columns (e.g., alter the length of varchar fiHOGs), Codegen will update the constraint­s on the MetaContro­ls, making sure you do not have to rewrite the logic. Feel free to copy the MetaContro­ls, Panels, Controls and Pages generated by Codegen and create your own classes by modifying them—they are there to help you, not to restrict you. However, do check for changes in schema since your FXsWRP fiOHs DUH QRW DXWRPDWLFD­OOy XSGDWHG. ,I yRX sLPSOy want to ‘add’ a functional­ity, it is better to create a new class inheriting from the generated class (much the same way ORM classes are inherited from ORM-Gen classes). Directory locations are also controlled using variables GHfiQHG LQ CRQfigXUDW­LRQ.LQC.ShS. If you want to change their location, you can. Though QCubed gives you the freedom to write your custom queries, do it when QQuery does not satisfy your needs perfectly. Try to stick to the generated classes wherever you can—it saves labour. DataGrids should be used to create simple tables with basic search functional­ity. DataGrids are not SEO friendly—they never provide a hyperlink to the second (and subsequent) page results; instead, work using actions and events. Use your own pagination if you require SEO. Your draft pages can be used to change data. Set ALLOW_ 5(027(BA'0,1 WR ‘)DOsH’ LQ WhH FRQfiJXUDW­LRQ fiOH WR PDNH sure that access to them is restricted. All the above are suggestion­s, not rules. If you have a reason to, you can violate them (e.g., when you want to access the draft pages on your website from a remote computer, you should set ALLOW_ REMOTE_ADMIN to your public IP address). Use Codegen as an aid and it will reduce about 70 per cent of your workload straight away—you must have already realised how!

 ??  ??

Newspapers in English

Newspapers from India