Skip to content

Polymorphic that works with deep associations and containable. You can also have specific conditions for each type of associated model. Improvement of the original Polymorphic by Andy Dawson (AD7Six)

Notifications You must be signed in to change notification settings

Dynamictivity/Polymorphic2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Polymorphic 2.0

Introduction

Polymorphic that works with deep associations and containable. You can also have specific conditions for each type of associated model. Improvement of the original Polymorphic by Andy Dawson (AD7Six)

Version 2.0 by Gothfunc and Theaxiom

Usage

In your find from the model that has polymorphic attached (i.e. Notification), here is a sample conditions array:

array(
	'conditions' => array(
		'Notification.user_id' => 1
	),
	'polyConditions' => array(
		'Post' => array(
			'conditions' => array(
				'Post.user_id' => 1
			),
			'contain' => array(
				'User' => array(
					'fields' => array('id', 'name')
				)
			)
		),
		'Comment' => array(
			'conditions' => array(
				'Comment.is_active' => true
			)
		)
	)
)	

About

Polymorphic that works with deep associations and containable. You can also have specific conditions for each type of associated model. Improvement of the original Polymorphic by Andy Dawson (AD7Six)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages