public function actionAdd()
{
    if ($this->isAjax()) {
        $this->payload->isModal = TRUE;
        $this->redrawControl("modal");
    }
}


public function actionEdit($id)
{
    // my application logic, entity fetch etc..., redirect if not existing

    $this["manageForm"]->setDefaults($this->entity->toArray());

    if ($this->isAjax()) {
        $this->payload->isModal = TRUE;
        $this->redrawControl("modal");
    }
}