yii2-relation-trait
yii2-relation-trait copied to clipboard
Yii 2 Models add functionality for load with relation, & transactional save with relation PLUS soft delete/restore feature
The Saveall() function will delete related records if those relations were not completely found by LoadAll() or were not fully presented on the CRUD view. Example .... - "Owner" -has...
Type 🐛 ```php class Company () { ... public function getBranches() { return $this->hasMany(\common\models\Branch::className(), ['company_id' => 'id']) ->andWhere(['type' =< 10 ]); } } ``` on update company record, those record...
My model is saved, but immediately deleted. The condition for the DELETE seems to be a value in a column that is NOT a relationship (FK) column. Thoughts?
The method deleteWithRelated() only seems to work with direct relations. So this works just fine: parent -> child If I $parent->deleteWithRelated() then both parent and child are soft deleted. However,...
Hi Guys, I use this great extension for different projects, thanks a lot!!! In my case, I would like to write the history of changes in Company Name in a...
Unless I'm using this trait incorrectly, to use soft deletes we need to always use the method $model->deleteWithRelated(). The method $model->delete() continues to do a hard delete. While I like...
The usage of _isset()_ raises a warning while using _hasProperty()_ does not. Hope il helps.
I'm using loadAll() function and works fine, but It doesn't populate the id for the related model `{ "id":"6", "idEscolaridade":"16", "descricao":"teste", "salario":5500.00, "Escolaridades":{ "id":"16", "descricao":"testando" } }` I'm using 'jaacoder/yii2-activated'...
Hi, I'm trying to retrieve releted data with $model->getAttributesWithRelated() but the result is empty. In the method there is a foreach ($this->relatedRecords as $name => $records) { but I don't...
I am trying to get taggable behavior to work and have tried both @creocoder [extension](https://github.com/creocoder/yii2-taggable) and @2amigos [extension ](https://github.com/2amigos/yii2-taggable-behaviorl) but cannot save the relations. Any ideas what the conflict is?...