using 1.3.4 Fatal error: Class name must be a valid object or a string in /usr/share/php/cake_1.3.4/cake/libs/class_registry.php on line 141
This is in CommentsController of my Comments plugin: public function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for Comment', true)); } else { $data = $this->Comment->read(array('Comment.model', 'Comment.foreign_key'), $id); $model = $this->data['Comment']['model']; if ($this->Comment->delete($id, false)) { $this->Comment->{$model}->updateAll( array("${model}.comments_count" => "${model}.comments_count - 1"), array("${model}.id" => $id) ); $this->Session->setFlash(__('comment deleted', true)); } else { $this->Session->setFlash(__('comment couldn\'t be deleted', true)); } } $this->redirect($this->referer()); } The error is being triggered by delete(). Lines 140-142 in ClassRegistry: if (class_exists($class) || App::import($type, $pluginPath . $class)) { ${$class} =& new $class($settings); } elseif ($type === 'Model') { I added a die(debug($settings)) inside the if block and got: Array ( [class] => Comments.Comment [alias] => Comment [id] => ) I tried setting $cascade to false with no luck. Although the problem is due to the COmment class, I also added, just before the delete() line: $this->Comment->unbindModel(array('belongsTo' => array($model))); No luck again, but I wasn't expecting any difference. Can anyone make any sense of this? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en