Skip to content

Unable to run save query #34

Description

@anubhav-wedig

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions