Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: $node does not have function getIsDeletedRecord() when calling appendTo #32

Open
ptheofan opened this issue Nov 25, 2013 · 1 comment
Assignees

Comments

@ptheofan
Copy link

This was hidden behind a rollback failure! Reached this after I modified
if(isset($transaction) && $transaction->active)
(at line 662)

Exception Message: Category and its behaviors do not have a method or closure named "getIsDeletedRecord".
Trace:
#0 /yii/db/ar/CActiveRecord.php(225): CComponent->__call('getIsDeletedRec...', Array)
#1 /application/components/behaviors/NestedSetBehavior.php(904): CActiveRecord->__call('getIsDeletedRec...', Array)
#2 /application/components/behaviors/NestedSetBehavior.php(904): Category->getIsDeletedRecord()
#3 /application/components/behaviors/NestedSetBehavior.php(658): NestedSetBehavior->correctCachedOnAddNode('2')
#4 /application/components/behaviors/NestedSetBehavior.php(325): NestedSetBehavior->addNode(Object(Category), '2', 1, true, NULL)
#5 [internal function]: NestedSetBehavior->appendTo(Object(Category))

any quickfix ideas/solutions?

@ghost ghost assigned creocoder Nov 25, 2013
@bupy7
Copy link

bupy7 commented Mar 13, 2014

You likely attaching behavior in a controller for model like as $model->attachBehavior(
'nestedSetBehavior',
array(
'class' => 'application.behaviors.NestedSetBehavior',
'leftAttribute' => 'lft',
'rightAttribute' => 'rgt',
'levelAttribute' => 'level',
'hasManyRoots' => true,
)
);
If added new record in root, then it does not caused problem. But! If added new record in existing record, then will be caused problem, which you described.

This is due to the fact what after getting model in which you want insert new record, you not attach behavior for this model! If this not do, you get exception, because in behavior exist property for validate and checking. In this case this property private $_deleted=false; at line 23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants