v4nz666 / lazy_loader Goto Github PK
View Code? Open in Web Editor NEWThis project forked from lorenzo/lazy_loader
CakePHP Plugin - Loads model asssociations as needed.
Home Page: www.pseudocoder.com
This project forked from lorenzo/lazy_loader
CakePHP Plugin - Loads model asssociations as needed.
Home Page: www.pseudocoder.com
/* * 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 <[email protected]> * @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')); }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.