Forums / Developer / Removing a node

Removing a node

Author Message

Eirik Alfstad Johansen

Wednesday 18 August 2004 5:20:47 am

Hi guys,

I have written an event type extension that is supposed to remove the main node of an object after having created several more nodes for this object, one of which is a new main.

The code I use to try and accomplish is as follows:

// remove temp node profiles
			eZNodeAssignment::remove(128, $object['id']);
			
			// publish the object
			$operationResult = eZOperationHandler::execute( 'content', 
			                                                'publish',
			                                                array( 'object_id' => $object['id'],
			                                                       'version' => $object['current_version']) );

This does remove the node from the eznode_assignment table in the database, but it still shows up as a child node of node 128 on the web site.

Am I missing a step?

Thanks in advance !

Sincerely,

Eirik Johansen
http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Eirik Alfstad Johansen

Wednesday 25 August 2004 12:54:12 am

Bump.

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Hans Melis

Wednesday 25 August 2004 1:11:29 am

Hi Eirik,

It's been a while since I've written some PHP code that removes nodes, but I just did a quick check of the old code and compared to the newest version in the ezp kernel classes.

I think you should fetch the node object ( eZContentObjectTreeNode::fetch() ) and then call the remove() function on that object.

Hans
http://blog.hansmelis.be

Eirik Alfstad Johansen

Wednesday 25 August 2004 3:06:02 am

Worked like a charm, Hans. Thanks a lot!

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/