Welcome Guest, Not a member yet? Register   Sign In
CI generator for crud (bash and php) 0.1
#11

[eluser]MikeHibbert[/eluser]
Well I had thought about YML but didnt just want to make rail for CI although if the other guys are happy for that to happen then its fine by me.

After all, I'm sure many existing PHP developers have seen rails and like the idea of the system but not the idea switching languages. No that Ruby isn't simple though, just its not a great idea to shift development languages when you are trying to focus on rapidly developing solutions at that point in time.

Mike
#12

[eluser]Dreammaker[/eluser]
In ideal world instead YML I would see web-interface for CRUD generation. We create new object (form field), set type (text, password, textarea, upload, additional type - date, etc) and/or create/select set of validation rules for it. Submit form and we see generated controller, model, simple view and created/renewed table(s) in database.

But YML is standart and maybe this is a better decision.

<off>
I hope you undestand my pure English Smile
</off>
#13

[eluser]MikeHibbert[/eluser]
Yeah I can see your wanting to create a yaml from a web interface and I think thats the long term goal.

Right now though I dont want to be tied into a set output structure as I tried that with codex and I found my learning curve increased the more I wanted custom designed admin, say for company branded admin or my own for private clients.

Codex is great and I wish I had time to learn more about it but for now I just want to create my code and tell it to make a form with some specified fields, textareas, option menus and check boxes without having to learn how to skin the to my needs.

Then I know that I can drop that form into pretty much any admin design I like without having to go too deeply into breadcrumb defs and such, (the codex guys probably think I'm talking rubbish lol).

I hope the codex guys dont take that the wrong way btw as I really think codex is a great tool but I just dont want to have to reskin codex to make it useful to me in my working day.

Mike

PS: I started building YAML into the system just a few hours ago and its already yeilding so interesting results. I will post the new yml version once its finished so you guys can have a play around with it.
#14

[eluser]MikeHibbert[/eluser]
Ok I have create the beginnings of the yaml based system Big Grin

First off you still call the generator in the normal way:

Code:
php crud/create [options] [table] [fieldnames]

But this time the create will make a yml file and build you the forms from that.

The file is created as 'crud/formDefs/tablename.yml' and takes the form of:

Code:
---
tablename:
  fieldname:
    - field type
  fieldname:
    - field type

so far you can add the normal fields like text, textarea, radio, checkbox and a 'special' feild that can contain code for the times when you wanna add things like '&lt;?=fckEditor?&gt;' instead of a textarea.

I havent put a file field in but it wouldnt be too hard to add it if you need it asap, I will post it again once its in there.

One last thing! if you want to start from scratch you need to delte the yml file and run the command again, or else it wont get over written. Also to update the views you can just run the command with the 'v' option or simple re-run the old command wich will create all but apply whats in the yml to your views.

Have a play around with this and please leave feedback or suggestions if you feel inclined.

I've left a text yml in the formDefs folder for you to look at too its called 'poo.yml', (I thought I would keep with the CRUD theme Big Grin )


Mike
#15

[eluser]MikeHibbert[/eluser]
Ok the file field was a quicky so her eit is with file fields added Big Grin

Mike
#16

[eluser]Dreammaker[/eluser]
Cool! Smile

Today or tomorrow I'll try to test. What about validation rules in yaml?
#17

[eluser]MikeHibbert[/eluser]
If we can have some suggestions on how that would look in th eyml then yeah sounds good to me.

At present all fields are set to required and all you need to do is delete them if they arent required or edit them for other option in the controller

Mike
#18

[eluser]Dreammaker[/eluser]
Maybe

Code:
---
tablename:
  fieldname:
    - field type
  fieldname:
    - field type
  validation:
    fieldname: [ rules1, rules2, rules3 ]
    fieldname: [ rules1, rules2 ]

?
#19

[eluser]MikeHibbert[/eluser]
Yeah that looks good to me as that would turn into an array when its loaded by Spyc and would look like:

Code:
Array(
  fieldname1 => "rule2 | rule2 | rul3",
  fieldname2 => "rule2 | rule2 | rul3"
);

I take a look at how that will fit in with the grand scheme of things and post it when its done

Mike
#20

[eluser]Dreammaker[/eluser]
Tested. Crud generator works. Smile

In free time I'll write little feature request list (what I want to see in crud generator). Maybe it be useful for planning of development.




Theme © iAndrew 2016 - Forum software by © MyBB