MODX Community

Way to set resource as deleted with xPDO?

Was looking for a way to set a specific resource to deleted with a xPDO statement.

For instance… here is a snippet:

    <?php
        var $resId = 100; //resource ID
        $q = $modx->newQuery('modResource');
        $q->where( array('id:=' => $resId) );
        $result = $modx->getObject('modResource', $q);
        if($result){
    	    $result->set('deleted', 1);
    	    $result->save();
        }

Also you may use processor.

2 Likes

That will work thank you.

1 Like