2016-11-22 10:06:03 +00:00
|
|
|
<?php define('__ROOT__', dirname(__DIR__));
|
|
|
|
|
|
|
|
require_once __ROOT__.'/autoloader.php';
|
|
|
|
|
|
|
|
use \lightdb\core\lightdb;
|
|
|
|
|
|
|
|
$sl = new lightdb('subject');
|
|
|
|
$cl = new lightdb('contact');
|
|
|
|
|
2016-11-22 16:17:04 +00:00
|
|
|
|
|
|
|
/* [1] Remove contacts
|
|
|
|
=========================================================*/
|
|
|
|
$sub = $sl->fetch(1);
|
|
|
|
|
|
|
|
$contactIds = $sub['contacts'];
|
|
|
|
$cl->deleteAll($contactsIds);
|
|
|
|
|
|
|
|
/* [2] Reset subject
|
|
|
|
=========================================================*/
|
|
|
|
unset( $sub['contacts'] );
|
|
|
|
unset( $sub['relations'] );
|
|
|
|
$sub['subject']['surveys'] = [];
|
|
|
|
|
|
|
|
$sl->delete(1);
|
|
|
|
$sl->insert(1, $sub);
|
2016-11-22 10:06:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
?>
|