Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

Latest commit

 

History

History
32 lines (28 loc) · 779 Bytes

readme.md

File metadata and controls

32 lines (28 loc) · 779 Bytes

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
			)
		)
	)
)