This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
README | Fri Jul 10 21:47:30 -0700 2009 | |
| |
lazy_loader_app_model.php | Fri May 01 22:36:45 -0700 2009 | |
| |
tests/ | Thu Jul 23 05:42:46 -0700 2009 |
README
/* * CakePHP Lazy Loader Plugin * Copyright (c) 2009 Matt Curry * http://www.pseudocoder.com/archives/2009/04/27/github-updates * * This is my second attempt at this. * The code posted by jose_zap (José Lorenzo - http://joselorenzo.com.ve/) * on bin.cakephp.org provided inspiration for this revised version * http://bin.cakephp.org/saved/39855 * * @author Matt Curry <matt@pseudocoder.com> * @license MIT * */ /* Requirements */ PHP 5.1 or greater /* Description */ The code is very beta. Please give it a shot and let me know where you hit snags. I've tested it in basic app using Containable and it works great. It probably doesn't work with $recursive. If you find a problem check out the unit tests and see if you can create a failing test case /* Instructions */ 1) Download the plugin to /app/plugins/lazy_loader 2) Put this either in your app_model.php or at the top of any model you want to use it: App::import('Model', 'LazyLoader.app_model'); 3) Have your model extend LazyLoaderAppModel instead of AppModel class MyModel extends LazyLoaderAppModel { ... } 4) For this to work for HATBM relationships you need to include the joinTable and associationForeignKey in the defination. This is because Cake uses the associated models to set the defaults for these. So even if you are following the conventions, set these to avoid having the related model loaded. class Post extends LazyLoaderAppModel { var $name = 'Post'; var $hasAndBelongsToMany = array('Tag' => array('joinTable' => 'posts_tags', 'associationForeignKey' => 'tag_id')); }







