Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run save query #34

Open
anubhav-wedig opened this issue Dec 24, 2020 · 0 comments
Open

Unable to run save query #34

anubhav-wedig opened this issue Dec 24, 2020 · 0 comments

Comments

@anubhav-wedig
Copy link

anubhav-wedig commented Dec 24, 2020

I wanted to use this plugin with y setup of CakePHP 3.8 but I am unable to run the save data query.

This is my save method in the controller:
`$admin = $this->Admins->newEntity();

    if ($this->request->is('post')) {
        $admin = $this->Admins->patchEntity($admin, $this->request->getData());

        if ($this->Admins->save($admin)) {
            $this->Flash->success(__('The admin has been saved.'));

            $response = array('success' => true, 'msg' => "success");
        } else {
            $this->Flash->error(__('The page could not be saved. Please, try again.'));
            
            $response = array('success' => false, 'msg' =>"error");
        }

        echo json_encode($response);
        die;
    }`

Commenting this line in the save function mentioned in the "hayko\mongodb\src\ORM\Table.php"
$entity->isNew() ? RulesChecker::CREATE : RulesChecker::UPDATE
Did make it work but I am not sure if it's the right way.

The error I get is "Call to a member function select() on array".
Please help me with it ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant