-
Create EAV tables in your database with (can be found in eav.sql).
-
Add behavior and relation to your model.
public function behaviors() { return array( ... 'eav'=>array( 'class'=>'EavBehavior' ) ... ); } public function relations() { ... return array( 'attributeValues' => array(self::HAS_MANY, 'EavAttributeValue', 'object_id', 'on' => 'attributeValues.object_entity="'.get_class($this).'"'), ); ... } -
Assign POST field while creating or updating the model. Be sure to save the object before setting values to EAV variables while creating.
$client->save(); ... $client->eavAttributes = $_POST['ClientAttribute']; $client->save();
-
Notifications
You must be signed in to change notification settings - Fork 0
ruslanbelziuk/yii-eav
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published