Rough Details on Classes for r3366 and Forward

Following the latest SVN trunk changes, classes are now all located under the classes folder. They also have a new cascading ability with the underscores(_) being new folders.

classes/
  controller/
  model/

All library classes are now located directly in the classes folder. Unless you create your own custom folder, and prepend the name on the class name. Ex.

ORM_Form is located in classes/orm/form.php

Controller_Admin_User would now be located in classes/controller/admin/user.php



Grouping of Models
The same change goes with models too. You can now cascade them into folders beneath the model folder.

(This is just an example, if you choose to put a group of models in a new folder)

/classes/model/
  blog/
    blogpost.php
    admin.php
    blog.php
    ...

Your model's class names would be

Model_Blog_Blogpost, Model_Blog_Admin, Model_Blog_Blog etc..

Because of the Classes' name change, ORM can no longer find out the table name automatically. (Without another change get the last underscore)

<?php

class Model_Blog_Blogpost extends ORM{
  protected $belongs_to = array('blog_blog', 'blog_admin'); // Relationships now need the folder name prepended also

  protected $table_name = 'blogposts'; // Need this or Orm would make this blog_blogposts, unless that's what you named your table which is also handy too
}

// To use relationships, you also need to have the folder name prepended
$post = Model_Blog_Blogpost(1);   // Get post id 1 just like normal
echo $post->admin->username;      // Old way
echo $post->blog_admin->username; // is now blog_admin because of the folder the model is in