Ejemplo n.º 1
0
 public function removeItem($post)
 {
     foreach ($post['id'] as $v) {
         removeElem((int) $v);
     }
 }
Ejemplo n.º 2
0
function removeElem($id, $object = '')
{
    while (true) {
        if ($object == '') {
            $object = Fx::db()->find(Fx::service_context()->namespace['construct_db'], array('$or' => array('id' => $id, 'ref' => $id)));
        }
        Fx::db()->remove($object[0]['object'], array('id' => $id));
        Fx::db()->remove(Fx::service_context()->namespace['construct_db'], array('id' => $id));
        $path = root . '/' . Fx::service_context()->config['folder']['files'] . '/' . $id . '/';
        Fx::io()->del($path);
        $find = Fx::db()->find(Fx::service_context()->namespace['construct_db'], array('parent' => $id));
        if (count($find)) {
            foreach ($find as $v) {
                removeElem($v['id'], array($v));
            }
        } else {
            break;
        }
    }
}