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

Model, controller and query #16

Closed
fehrenmann opened this issue Mar 29, 2017 · 1 comment
Closed

Model, controller and query #16

fehrenmann opened this issue Mar 29, 2017 · 1 comment

Comments

@fehrenmann
Copy link

Hi Tiago

I am trying to use your plugin but i'm facing some issues with a simple find.

For example, I have a mongo table : markers
As it is suggested in the readme, I created a MarkersTable php file, with the use Hayko\Mongodb\ORM\Table at the beginning of the file;
But what about controller ? I wrote this lines in my Markers controller :

$this->loadmodel('Markers');
$marker = $this->Markers->find_markers($keyword);

where the find_markers function is in the MarkersTable php file :

public function find_markers ($keyword) {        
        $marker = $this->Markers->find('all', ['conditions' => ['name' => $keyword]]);
        return $marker;
    }

Do i have to load in my controller the table as i said below ? ($this->loadmodel('Markers'); ) It seems not cause i have an error (Unknown method "find_markers"...Could this be caused by using Auto-Tables ?)

Thanks by advance for your help and for your work

@tiaguinho
Copy link
Owner

You don't need to do that.
Just use $this->Markers->find_markers(); inside your controller.
Cakephp will handle the rest.

Cheers.

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

2 participants