TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
CRUD Scaffolding - anyone interested?
  • Hi folks,

    We've been using Kohana for a while now (the development team at Endemol), and are considering releasing some of our code back into the community as a way of saying thanks... However, before we do, it'd be interesting to gauge whether people are interested in what we've got to offer, and how best to distribute it.

    One of the first bits of code we're looking at releasing is an extendable CRUD Controller that takes the hassle out of building admin interfaces, as well as reducing the lines of code needed to get a basic CRUD interface up and running. No magic code generation (a la symfony, which was a nightmare to debug), and it supports has_one/many/belongs to/has and belongs to relationships, which will allow you to do 80-90% of your admin interfaces (at least for loading data) in just a few lines.

    We'd have to strip out some of our site specific code, and I've no doubt the community will have ideas about our possibly dodgy code, however, we'd be happy to take all comments on the chin and improve it over time.

    So here's the question - is this functionality needed? How best would you like it delivered to you (possibly a project here on Kohana?), and presumably you'd want a stripped clean version (or would you like us to supply some of our clean admin templates, css and icons to get things moving?)

    We'd love to get your feedback, so please let us know!

    Cheers,

    Nathan.
  • I'm sure many people will have a need for a proper CRUD system, and some others might even not be aware yet of the usability of a CRUD interface.

    All Kohana modules are stored at http://dev.kohanaphp.com/projects/. An admin can open up a project space for you, so you can upload your system and provide some documentation. And then if you want, you can start a Release: CRUD interface thread in this forum to announce the release and hopefully get people talking about it :-).
  • I would LOVE to have a quick and easy CRUD system available to initially populate the database.
  • I feel that your design will be accepted by all. Most notedly the new users who have to struggle with learning about kohana. Having a plug-in to use as well as review for knowledge will always be welcome. If, for some reason there are problems, you will see then how many use and admire your efforts. Thanks for sharing in advance.
  • Good stuff - we'll work on cleaning out some of our framework specific stuff - in the meanwhile, can an admin get us an account setup on projects?

    Wouter - is this something you can help setup?
  • Hey nat,

    For sure. I tend to use Navicat these days, but it would still be really useful.

    By the way, if you're London-based, a few of us were planning on doing some Kohana-type meetups from time to time. Let us know if you or any of your team are interested.

    :D

  • Hi Dave,

    We're definitely up for some London-based meetups - keep us in the loop!

    Cheers,
  • There is already a scaffolding project.

  • Hi Shadowhand,

    Saw the scaffolding project after revisiting the projects area. I think our scaffolding module differs in both functionality and purpose from the one there, so I'll release it on my personal site, and garner public opinion of it's usefulness there. Presumably if the interest is enough, and the two modules are deemed different enough, you'll consider opening a new project for it?
  • I'm sorry, I cannot create projects on the project page. Shadowhand can though (i think) :-)

    Apparently there is another scaffolding project, so it might be wise to see how they compare.
  • A big thumbs up from me.

  • Hi folks,

    I've packaged up the code as best I can (it's late here, i'm hungry, and need to go home and get some rest), along with some instructions.

    Hopefully it'll work out the box - if it doesn't, please leave comments on the blog, and i'll try and help where possible.

    Shadowhand - can you spare a few minutes to see if this is something worthy of getting a project opened for it. Also, and I'm sure you're a busy man, but do you fancy giving me any pointers on the code, where you feel there's a non-kohana way something has been done? We'd love to get your feedback.

    The code, and rough documentation can be found here.

    I've attached as many support zip's as possible, as well as images to give you an idea of how it looks and feels.

    Feedback appreciated.

    Cheers folks.
  • Love the interface... if this could support relationships, it would be fantastic - that's what I've tried to implement in the scaffolding project (which is extremely outdated).

    When selecting an Article's owner (a User), it is much easier to have a drop down or be able to search the users table rather than inputting the ID yourself.
  • Thanks jheathco, glad you like it.

    We're already using it successfully with relationships - setting up a $has_one, $has_many or $has_and_belongs_to_many relationship in the model should be automatically detected and the relevant data pulled in (you'll get a dropdown if it's a $has_one relationship, and a set of checkboxes if there's a $has_and_belongs_to_many relationship defined).

    I noticed that the most recent version of the Formo module appears to display select boxes incorrectly (the key and the value appear to be reversed), which I'll investigate tomorrow and if necessary, submit a patch to the Formo project.

    I'll be creating some more in depth documentation tomorrow, along with a few examples. Did you have any success with the example module supplied? The "Artists" module contains three models and three controllers - between those three, there's a $has_many and a $has_and_belongs_to_many relationship defined, which should work out the box! (a CD has 1 record_label, and many artists)

    Please feel free to feedback any problems or suggestions you have and we'll add them to the pile!
  • Looks really nice... I will try that!


    I haved developed an EAV (entity-attribute-value) module for storage of loose coupled info, nice for not-so-fixed data for CMS. I am developing the new portal for Honda Argentina.

    Probably I will use this idea of scaffolding for my admin panel.

    I could share the EAV Module after the de release of the portal.
  • I don't see why this wouldn't deserve its own project on the projects page :O

    EDIT: It's great :)
  • Since it is quite different in approach than scaffold it should have its own project and crud_scaffolding is a great project name.

    It has a great design in its simplicity by harnessing the power of formo. Great job.

    I am going to use it on some of my projects. I have pushed scaffold about as far as I can and need crud_scaffolding for some specific projects.

    toulon

  • Thanks for the comments and feedback folks.

    I've set up a project repo for it (using redmine, so it should be familiar to those of you who use the Kohana projects repo) here:

    There seems to be some intermittant problem with my rails server, so this link appears to go down - I've yet to experience it - if you can't see the site, please persist, and maybe drop me a whisper below - I'll look into what's causing the problem.

    http://projects.nathanbentley.com/projects/show/crudscaffold

    Alternatively, try using:

    http://projects-alt.nathanbentley.com/projects/show/crudscaffold

    Please feel free to download the files from there, leave feedback and bug reports (1st one already submitted and patched today) and comment on features you'd like to see be developed.

    I'm taking a break from work for a week, so will be without the interweb until I get back - would love to hear from you all once I do.

    Cheers,

    Nathan.
  • Posted By: natbentley

    I've set up a project repo for it (using redmine, so it should be familiar to those of you who use the Kohana projects repo) here:

    http://projects.nathanbentley.com/projects/show/crudscaffold



    Link broken?
  • Sorry folks, had an epic DNS fail.

    Link should be working now - please let me know if you have problems accessing the site.

    Cheers,

    Nath.
  • @natbentley: DNS seems failing again
  • I think I am missing something about scaffolding... If that is just used to initially populate the database, can someone explain me why it is worth implementing while you have phpMyAdmin or an equivalent database administration solution ? What's the benefit ?
  • @ccazette - it's a fair question - scaffolding isn't for everyone, and if you're technical, you could easily use something like phpMyAdmin to the same effect. If you're a client, however, something like phpMyAdmin can be a scary place - we've aimed to create a simple interface to allow both techincal and non-technical people to manipulate data in one or more tables, quickly and easily.

    With the CRUD scaffold project, we've tried to take this one step further and create an interface which could be used on a day to day basis - many of our clients are using this interface to update their sites, from simple content snippets to complex data structures for film companies (with many relationships between films, production houses, artists, directors, content and videos).

    So to answer your question, yes, if you're just using it to initially populate a database and you're happy with phpmyadmin or the CLI, you'd be better off saving yourself some time. If you're looking for something a little more robust for non technical users, or something a little more longterm, you may want to consider taking a look at the scaffolding solutions available.
  • I'm very interested in this project, but the link is broken. Anyone care to upload it somewhere else so I/we can grab it?

    Thanks!
  • @willemmulder - what issues are you having with the site - just tried the link and it seems to be fine from here (my office connection) - I've also tested it from my home, and via my iphone (all different networks) - all show it fine.

    I'm starting to wonder if there's something wrong with the Rails passenger setup running that instance of redmine - a number of people have had a problem accessing it, but whenever I check it it seems ok.

    If shadowhand is willing to setup a Kohana project for this, I'd be happy to migrate the data over.
  • It seems opendns is lagging a bit with your DNS entry on some of its cache servers, it works fine from my home connection which isn't using opendns, but here at work we do and your site is inaccessible. http://www.opendns.com/support/cache/?d=projects.nathanbentley.com

    The results have changed a few times since I linked that, it should be accessible for most opendns users now.

  • thanks drantin,

    just checked and it looks like Palo Alto and Seattle opendns servers are still lagging - no idea what's causing the lag, but hopefully it'll work its way out sooner rather than later. I might setup an alternative domain tonight if I get a chance - hopefully that'll give people a better chance of seeing the site.
  • Still

    502 Proxy Error

    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request GET http://projects.nathanbentley.com/projects/show/crudscaffold.

    Reason: DNS lookup failure for: projects.nathanbentley.com

    Apache/2.2.4 (Unix) PHP/4.4.8 Server at projects.nathanbentley.com Port 3128

    --

    this one is working though
    http://nathanbentley.com/kohana-crud-scaffold-project-0-6beta/

    weird :-)
  • Hi folks,

    Here's an alternative domain for the same redmine installation (complete with code, examples and documentation):

    http://projects-alt.nathanbentley.com/projects/show/crudscaffold

    I'm not sure why opendns aren't caching this address properly, but I'll keep an eye on the situation.
  • Been reading the complete guide and it looks very promising! I've been writing something similar (also with Formo ;-)) but I never finished the project, and as far as I can see I wouldn't have created something so good-looking and usable as you did. Great job and thanks!
  • @natbentley: been testing crud_scuffold and it works great, i do have some stuff that i need help on like:

    - model user has many phone numbers... (multiple inputs for phone numbers on my form)
    - model user has many photos... (multiple file uploads for phone numbers, save filename to db)

    Thanks!
  • @webninja

    I'll add the requested functionality to the list of stuff to do - if you get a spare moment, could you file a feature request on the project site. Alternatively, if you come up with a solution before we do, please feel free to submit a patch and I'll look at integrating it.

    Cheers,
  • Very clever indeed, useful and good-looking, indeed.
  • I am using kohana 3 and try the crud-scaffold module i have download the artist.zip file

    But i am getting some errors I can't test the module. Kindly help me on this ASAP

    Absolute Path: E:\xampp\htdocs\subha\kohana\

    URL: http://localhost/subha/kohana/ (Using Xampp)

    Below I have pasted my bootstrap.php baseurl setting and module settings. I have place the artists module inside module folder correctly

    ============================================================
    Kohana::init(array(
    'base_url' => '/subha/kohana/',
    ));

    Kohana::modules(array(
    // 'auth' => MODPATH.'auth', // Basic authentication
    'crud_scaffold' => MODPATH.'crud_scaffold', // Basic authentication
    'cache' => MODPATH.'cache', // Caching with multiple backends
    // 'codebench' => MODPATH.'codebench', // Benchmarking tool
    'database' => MODPATH.'database', // Database access
    'formo' => MODPATH.'formo',
    // 'image' => MODPATH.'image', // Image manipulation
    'orm' => MODPATH.'orm', // Object Relationship Mapping
    'artists' => MODPATH.'artists',
    // Object Relationship Mapping
    // 'oauth' => MODPATH.'oauth', // OAuth authentication
    // 'pagination' => MODPATH.'pagination', // Paging of results
    // 'unittest' => MODPATH.'unittest', // Unit testing
    // 'userguide' => MODPATH.'userguide', // User guide and API documentation
    ));

    ============================================================

    While i try to run the module
    http://localhost/subha/kohana/artists/

    I am getting the following error. I think i may be wrong on my base URL and hence i am getting these kind of problems. Kindly let me know a better solution to solve the isssue.

    ============================================================
    ReflectionException [ -1 ]: Class controller_artists does not exist

    SYSPATH\classes\kohana\request.php [ 1094 ]

    1089 Request::$current = $this;
    1090
    1091 try
    1092 {
    1093 // Load the controller using reflection
    1094 $class = new ReflectionClass($prefix.$this->controller);
    1095
    1096 if ($class->isAbstract())
    1097 {
    1098 throw new Kohana_Exception('Cannot create instances of abstract :controller',
    1099 array(':controller' => $prefix.$this->controller));

    1.

    SYSPATH\classes\kohana\request.php [ 1094 ] » ReflectionClass->__construct(arguments)
    0

    string(18) "controller_artists"

    1089 Request::$current = $this;
    1090
    1091 try
    1092 {
    1093 // Load the controller using reflection
    1094 $class = new ReflectionClass($prefix.$this->controller);
    1095
    1096 if ($class->isAbstract())
    1097 {
    1098 throw new Kohana_Exception('Cannot create instances of abstract :controller',
    1099 array(':controller' => $prefix.$this->controller));

    2.

    APPPATH\bootstrap.php [ 112 ] » Kohana_Request->execute()

    107 /**
    108 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
    109 * If no source is specified, the URI will be automatically detected.
    110 */
    111 echo Request::instance()
    112 ->execute()
    113 ->send_headers()
    114 ->response;
    115 }

    3.

    DOCROOT\index.php [ 103 ] » require(arguments)
    0

    string(54) "E:\xampp\htdocs\subha\kohana\application\bootstrap.php"

    98 // Load empty core extension
    99 require SYSPATH.'classes/kohana'.EXT;
    100 }
    101
    102 // Bootstrap the application
    103 require APPPATH.'bootstrap'.EXT;

    Environment
    ============================================================

  • http://github.com/birkir/kocrud

    REST CRUD API with authentication as extension on ORM class.

    Thread for it, below this one.
  • @natbentley
    will there be version for Kohana 3 ?

  • Is this project still up? Is there a leading scaffold / admin generation system for Kohana 3?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion