Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 657025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:46:41+00:00 2026-05-13T22:46:41+00:00

I have some models witch are using Doctrine nestedset feature. I want to add

  • 0

I have some models witch are using Doctrine nestedset feature.
I want to add delete functionaly of elements from tree since that is required in my application. I was trying with snippets from documentation but I am getting a very strange error with that code.

YAML is here: http://pastie.org/820978

And I am trying with this code in my Menu class witch extends generated abstract class BaseMenu and BaseMenu extends Doctrine_Record 🙂

Anyway my code:

 public function getMenuItem($id)
 {
     return Doctrine::getTable('Menu')->find($id);
 }

 public function delete($id)
 {
     $item = $this->getMenuItem($id);

     //echo get_class($item); will return Menu so object exists !?

     $item->getNode()->delete();
 }

And I get this an error:

Fatal error: Call to a member function
getNode() on a non-object

And I just noticed that get_class($item) is trowing a warring (so that probabbly is reason for this strange behavior):

Warning: get_class() expects parameter
1 to be object, boolean given in…

However I need a solution for this and all hints are welcome…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:46:42+00:00Added an answer on May 13, 2026 at 10:46 pm

    getNode() returns a Doctrine_Node, not a Doctrine_Record.

    A Doctrine_Record can be deleted, but a Doctrine_Node cannot be deleted — because it is not persistent anyway.

    The correct logic would simply be:

    $item = $this->getMenuItem($id)->delete();
    

    Also, don’t name a method in your model ‘delete’!! This will override Doctrine_Record’s delete() method, which will drive you crazy trying to debug it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some models and I want to generate a multi-selection form from this
In my Rails 3.1 project, I have some models with lots of associations. Using
I'm using backbone with some nested models. I have a bunch of change handlers
I have few DB tables, witch are build using inheritance from one table witch
In my isometric flash game I have some models with long shadows. I want
I have some Mongoose Models with geospacial indexes: var User = new Schema({ name
I have some models that are laid out like so (with a lot more
I've encountered some problems with MongoID. I have three models: require 'mongoid' class Configuration
I have some models; Vocabularies (tags lists), Labels (tags) and different articles types. These
Let's say I have some models: User , Post , and Vote . A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.