We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Vokuro deleteAction

Hello,

i am using the Vokuro system, and now i am trying to use the delete function, but it aborts in Model Users.php.

What could be the problem?

It goes always in the second if " if (!$user->delete()) " with Model message

public function deleteAction($id)
{
    $user = Users::findFirstById($id);
    if (!$user) {
        $this->flash->error("User was not found");
        return $this->dispatcher->forward(array(
            'action' => 'index'
        ));
    }

    if (!$user->delete()) {
        $this->flash->error($user->getMessages());
    } else {
        $this->flash->success("User was deleted");
    }

    return $this->dispatcher->forward(array(
        'action' => 'index'
    ));
}

 $this->hasMany('id', 'Vokuro\Models\SearchCriteria', 'usersId', array(
        'alias' => 'searchCriteria',
        'foreignKey' => array(
            'message' => 'Search cannot be deleted because it\'s used on Users'
        )
    ));

Rgds Stefan

what message you are getting?



59.9k

Hello Emilio,

i get the message from Model 'message' => 'Search cannot be deleted because it\'s used on Users'. i found a way but it is not really the most elegant. I use raw SQL with LEFT JOIN for deleteAction now, it is working, but i think it is not in sense of the inventor :-)

Rgds Stefan