Added example and some doc for CakeSchema callbacks #249

Merged
merged 4 commits into from Apr 23, 2012

Conversation

Projects
None yet
3 participants
@huoxito
Contributor

huoxito commented Apr 23, 2012

No description provided.

+ if(isset($event['create'])){
+ switch($event['create']){
+ case 'posts':
+ $this->Post = new Post();

This comment has been minimized.

@lorenzo

lorenzo Apr 23, 2012

Member

It is usually better to use ClassRegistry. Also you should take into consideration the connection that was passed to the schema, models will use the default connection if no parameters are passed.

@lorenzo

lorenzo Apr 23, 2012

Member

It is usually better to use ClassRegistry. Also you should take into consideration the connection that was passed to the schema, models will use the default connection if no parameters are passed.

This comment has been minimized.

@huoxito

huoxito Apr 23, 2012

Contributor

Added commit to use ClassRegistry.

@huoxito

huoxito Apr 23, 2012

Contributor

Added commit to use ClassRegistry.

@huoxito

This comment has been minimized.

Show comment
Hide comment
@huoxito

huoxito Apr 23, 2012

Contributor

Hey @lorenzo also added the connection property to the example. Check if thats ok now.

Contributor

huoxito commented Apr 23, 2012

Hey @lorenzo also added the connection property to the example. Check if thats ok now.

+ if(isset($event['create'])){
+ switch($event['create']){
+ case 'posts':
+ $this->Post = ClassRegistry::init('Post');

This comment has been minimized.

@markstory

markstory Apr 23, 2012

Member

Why not just make a local variable? The object property isn't reused at all. A local variable will be garbage collected at least.

@markstory

markstory Apr 23, 2012

Member

Why not just make a local variable? The object property isn't reused at all. A local variable will be garbage collected at least.

This comment has been minimized.

@huoxito

huoxito Apr 23, 2012

Contributor

My mistake, added commit to make that var local

@huoxito

huoxito Apr 23, 2012

Contributor

My mistake, added commit to make that var local

markstory added a commit that referenced this pull request Apr 23, 2012

Merge pull request #249 from huoxito/master
Added example and some doc for CakeSchema callbacks

@markstory markstory merged commit f572fc0 into cakephp:master Apr 23, 2012

@markstory

This comment has been minimized.

Show comment
Hide comment
@markstory

markstory Apr 23, 2012

Member

Thanks again :D

Member

markstory commented Apr 23, 2012

Thanks again :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment