Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

[INVO Bug] One Bug happens when edit an item

When I find out, I saw one bug in INVO project.

This bug happens on all model. It displays wrong notice when edit an item

Scenario:

  • Choose any model, search them. In this scenario, i chose Company

  • Click Edit any item.

  • Clear data of any required row.

  • Click Save

  • The notice appear (Something like this: "Name is required")

  • Add info for that required row

  • Click Save

  • The notice appear not correctly

Expect notice: Company was updated successfully

Actual notice: Company was created successfully

I think this bug happens because of code:

CompaniesController.php

    $data = $this->request->getPost();
    if (!$form->isValid($data, $company)) {
            foreach ($form->getMessages() as $message) {
                $this->flash->error($message);
            }
            return $this->forward('companies/new');
        }

I'm just a newbie with Phalcon. So how can we fix that?

Thanks so much.

Hi, I'm a newbie too, I did all the step you listed and I was able to reproduce the issue. It is correct what you said, after the validation fails the 'new' action is used so the 'new' view script that send form data to 'companies/create'.

Perhaps you should add an issue https://github.com/phalcon/invo/issues

Cheers



2.1k
Accepted
answer

Thank you, I posted that issues to invo github: https://github.com/phalcon/invo/issues/37

Hi, I'm a newbie too, I did all the step you listed and I was able to reproduce the issue. It is correct what you said, after the validation fails the 'new' action is used so the 'new' view script that send form data to 'companies/create'.

Perhaps you should add an issue https://github.com/phalcon/invo/issues

Cheers