Welcome Guest, Not a member yet? Register   Sign In
ABCD (general-purpose CRUD library)
#1

[eluser]Gerson[/eluser]
Hi everyone!

I’m a Designer who is trying to play with web development using CI. I’ve been trying to build a general-purpose CRUD library to make it easier and faster to develop controllers that interact with a DB without the need of manually writing the cruds or Models to use with ORM libraries (think on it as a super-smart-scaffolding to be used as part of a final project like and CMS, a CRM or whatever you need/want).

• This is not about code generation (yml, symphony, etc);
• This is not about a framework or admin interface/system (Rapyd, etc);
• This is not about database software/administration (CiMyAdmin, etc);
• This is not about form validation;

=> This is about a VERY simple general-purpose Controller/Action CRUD library.

This library already reads the DB table to look for the fields and automatically builds the grid view of the data, the forms to create and edit content and all the needed crud stuff. It's not about generating code, it's a single smart library that does all the job. With few lines of configuration inside the controller you can change how it displays data in the grid and the fields of the form, also specifying the table’s relationships. <= That’s the point where I’m stopped because of my lack of knowledge. It already works with “has one”, but didn’t with “many”. Also, I don’t know how to automatically read the FK information from the DB’s table (even if it’s InnoDB) and create the relationship without the need of at least one line of config code.

I’d like to improve this piece of code and distribute it freely over GPL (just to make mine and everyone's life easier). Would you be interested in contribute with it?

There's no demo available yet.
You can find the source at http://www.gersongoulart.com.br/testsite5.dev.zip

What you'll find out on this zip package:

- The whole CI is already there;
- I moved the /application folder to the root (just to make it easier to update CI);
- I created a basic .htaccess on the root to remove the index.php from the url;
- I changed the ./application/autoload.php to autoload the database helper;
- I changed the ./application/database.php to setup my DB;
- I included (on the root) the SQL example of my DB;
- I changed the ./application/routes.php file writing a small php code to read/know all the .php files inside the ./application/controllers folder and use it on routes for my default controller and for the CRUD operations ( over the ABCD naming pattern (Add+Browse+Create+Delete));
- I started creating the ABCD library based on Giordano Piazza's crud (http://ellislab.com/forums/viewthread/71853/), which means one single library ./application/library/abcd.php and a folder ./application/fields with several files to build form fields and table relationships.
- Inside the controllers must exist an ABCD() function to configure the crud and handle it's requests (creating the grid, form, handling the actions and, in the future, user permissions, etc.).

As I said the point now is to improve the support to table's relationships. Anyone who desire to collaborate and use this library will be very welcome.

Best Regards!
Gerson Goulart
#2

[eluser]Colin Williams[/eluser]
Why does anyone need a CRUD library? The database class has all the CRUD ops needed. Then you write models to interact with the db class.

Or, is this just an example application?
#3

[eluser]Wuushu[/eluser]
Colin: Because many people find writing create/update/delete forms/methods/models over and over again tedious.
#4

[eluser]Gerson[/eluser]
Thanks Colin Wink
#5

[eluser]gyo[/eluser]
The original idea was to provide an easy to use and lightweight library to support CRUD.
It's different from scaffolding cause it's customizable and allows for more different fields types, and it uses database class automatically so you don't have to write queries.
A LOT of times I've been doing and re-doing this kind of code that's why I needed it.

@Gerson: cool man! I'll try this one later and give you feedback.
#6

[eluser]Gerson[/eluser]
Hi Gyo! Thank you of ryour attention on it... I hope to hear your feedback soon.




Theme © iAndrew 2016 - Forum software by © MyBB