Browse Source

Merge pull request #12 from defk/patch-1

В описание модели добавлены PhpDoc-свойства для работы автодополнений в IDE
master
PaulZi 7 years ago committed by GitHub
parent
commit
6b99daf279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      README.md

13
README.md

@ -83,12 +83,21 @@ class m150722_150100_multiple_tree extends Migration
```php ```php
use paulzi\nestedsets\NestedSetsBehavior; use paulzi\nestedsets\NestedSetsBehavior;
/**
* @property integer $id
* @property integer $lft
* @property integer $rgt
* @property integer $depth
*
* @mixin NestedSetsBehavior
*/
class Sample extends \yii\db\ActiveRecord class Sample extends \yii\db\ActiveRecord
{ {
public function behaviors() { public function behaviors() {
return [ return [
[ [
'class' => NestedSetsBehavior::className(), 'class' => NestedSetsBehavior::class,
// 'treeAttribute' => 'tree', // 'treeAttribute' => 'tree',
], ],
]; ];
@ -291,4 +300,4 @@ To delete a node with descendants:
$node11 = Sample::findOne(['name' => 'node 1.1']); $node11 = Sample::findOne(['name' => 'node 1.1']);
$node11->delete(); // delete node, children come up to the parent $node11->delete(); // delete node, children come up to the parent
$node11->deleteWithChildren(); // delete node and all descendants $node11->deleteWithChildren(); // delete node and all descendants
``` ```

Loading…
Cancel
Save