creocoder / yii2-nested-sets

The nested sets behavior for the Yii framework.
Other
446 stars 129 forks source link

Cant Save My Root Node #7

Closed DrMabuse23 closed 10 years ago

DrMabuse23 commented 10 years ago

$root = new NestedMenuTree(); $root->title = Sanitizer::getSanitizedUrlValue($model->title); if($root->saveNode()){ VarDumper::dump($root->attributes,10,true); }else{ VarDumper::dump($root->getErrors(),10,true); };

Thats my try result:

[ 'root' => [ 0 => 'Root cannot be blank.' ] 'lft' => [ 0 => 'Lft cannot be blank.' ] 'rgt' => [ 0 => 'Rgt cannot be blank.' ] 'level' => [ 0 => 'Level cannot be blank.' ] ]

? i missunderstand anything ? your behavior will create it or not ?

creocoder commented 10 years ago

Can you show your model dump? Seems you have at least 4 excess validation rule.

DrMabuse23 commented 10 years ago

thx for the tip! i have to change the title from the issue to cant read to late your Api .....

There is no need to validate fields specified in leftAttribute, rightAttribute, rootAttribute and levelAttribute options. Moreover, there could be problems if there are validation rules for these. Please check if there are no rules for fields mentioned in model's rules() method.

but thx anyway