src/App.php
public function __async_delete($id, $afterAction, $afterMaterialId, $afterStructureId)
    {
        /** @var array $result Async response */
        $result = array( 'status' => false );

        /** @var \samson\cms\CMSMaterial $material */
        $material = null;

        // If such material exists
        if ($this->query->className('\samson\cms\CMSMaterial')->id($id)->first($material)) {
            // Delete this table material with it's all relations to structures and fields
            $material->deleteWithRelations();

            Event::fire('samson.cms.web.materialtable.delete', array($material->parent_id));
            // Set success status
//            $result['status'] = true;

            $result = $this->__async_table($afterMaterialId, $afterStructureId);
        }
        // Return result
        return $result;
    }
public function __async_delete($id, $afterAction, $afterMaterialId, $afterStructureId)
    {
        /** @var array $result Async response */
        $result = array( 'status' => false );

        /** @var \samson\cms\CMSMaterial $material */
        $material = null;

        // If such material exists
        if ($this->query->className('\samson\cms\CMSMaterial')->id($id)->first($material)) {
            // Delete this table material with it's all relations to structures and fields
            $material->deleteWithRelations();

            Event::fire('samson.cms.web.materialtable.delete', array($material->parent_id));
            // Set success status
//            $result['status'] = true;

            $result = $this->__async_table($afterMaterialId, $afterStructureId);
        }
        // Return result
        return $result;
    }
public function __async_delete ( $ id , $ afterAction , $ afterMaterialId , $ afterStructureId ) { /** @var array $result Async response */ $ result = array ( 'status' => false ) ; /** @var \samson\cms\CMSMaterial $material */ $ material = null ; // If such material exists if ( $ this -> query -> className ( '\samson\cms\CMSMaterial' ) -> id ( $ id ) -> first ( $ material ) ) { // Delete this table material with it's all relations to structures and fields $ material -> deleteWithRelations ( ) ; Event :: fire ( 'samson.cms.web.materialtable.delete' , array ( $ material -> parent_id ) ) ; // Set success status //            $result['status'] = true; $ result = $ this -> __async_table ( $ afterMaterialId , $ afterStructureId ) ; } // Return result return $ result ; }
Controller for deleting row from material table
@param string $id Table material identifier
@param $afterAction
@param $afterMaterialId
@param $afterStructureId
@return array Async response array
Controller for deleting row from material table