Further experimentation with framework making CRUD Scaffolding scripts.

Discussion in 'Web Design and Development' started by Cabbit, Mar 5, 2010.

  1. Cabbit macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #1
    Hey folks for my most wonderful Cabbit php framework i would like to create something like the rails script/generate scaffold command that is used in the terminal.

    Now I am unsure of how complex this is or what software one would use to create such a command so i am looking for some pointers in the right direction.

    My aim in the end would be that with a terminal command i can generate php files based on parameters.

    For example

    scaffold Post tile:string body:text

    would create a model called posts, a cabbit_controller and 4 view files(CRUD).

    So if anyone has some wee pointers to get me started it would be most welcome for now i am going to put it down to fairies and goblins.
     
  2. Cabbit thread starter macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #2
    Well i took a wee nose round the bundled script generate that comes with rails and so far i have found its a Unix Executable File.
    So i am going to have a little nose in these files, i mind back in college learning about batch files so i am thinking these are the unix versions.

    Code:
    #!/usr/bin/env ruby
    require File.expand_path('../../config/boot',  __FILE__)
    require 'commands/generate'
    
     
  3. nkezhaya macrumors newbie

    Joined:
    Jan 6, 2010
    #3
    Why not just use Rails?

    Actually, why would you ever use PHP for something other than lowering your self-esteem?

    By the way, that script/generate file isn't a shell script, it's a Ruby script that imports the commands/generate Ruby file. The actual generate code imports the arguments you give it to create the requested scaffold.
     
  4. Cabbit thread starter macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #4
    Well i do use Rails but it is not the only language out there and this is a project to create a MVC framework using PHP that mimics some of the interesting Ruby on Rails features.

    Its the bases of my honours year thesis and my personal hobby, now i could start writing my own Ruby framework but my lectures don't know what the heck that is.

    Now if it ties closely into Ruby for the script generate command then i'll be looking at how Zend accomplishes the same task.
     

Share This Page