public function delete($restriction)
{
$parentVpId = $restriction[$this->parentReferenceName];
$parent = $this->parentStorage->loadEntity($parentVpId, null);
$fieldToDelete = $this->getJoinedKeyByVpId($parent, $restriction['vp_id']);
$oldEntity = $this->extractEntityFromParentByVpId($parent, $restriction['vp_id']);
$oldParentEntity = $parent;
$parent[$fieldToDelete] = false;
// mark for deletion
$newParentEntity = $parent;
$this->parentStorage->save($parent);
return $this->createChangeInfoWithParentEntity($oldEntity, $oldEntity, $oldParentEntity, $newParentEntity, 'delete');
}
private function deletePostMeta() { $this->storage->delete(EntityUtils::preparePostMeta(self::$vpId, self::$postVpId)); $this->postStorage->delete(EntityUtils::preparePost(self::$postVpId)); $this->postStorage->delete(EntityUtils::preparePost(self::$post2VpId)); $this->userStorage->delete(EntityUtils::prepareUser(self::$authorVpId)); return [['vp_id' => self::$authorVpId, 'parent' => self::$authorVpId], ['vp_id' => self::$postVpId, 'parent' => self::$postVpId], ['vp_id' => self::$post2VpId, 'parent' => self::$post2VpId], ['vp_id' => self::$vpId, 'parent' => self::$postVpId]]; }