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

read does not work! #82

Closed
ghost opened this issue Oct 11, 2013 · 3 comments
Closed

read does not work! #82

ghost opened this issue Oct 11, 2013 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2013

Created by Erol Elcan, 26th Oct 2012. (originally Lighthouse ticket #42):


Hi,

If you have a table which contains a primary key that named different than 'id' read() is not working.
I hope you will understand my bad English.

Thanks

@ghost
Copy link
Author

ghost commented Oct 11, 2013

29th Oct 2012, Owen Smithyman said:


Holy crap, it's true! Erol, thank you so much. I've been going crazy for the last two hours trying to figure out why I'm not getting anything in my view. There are no errors either. It's just as though you had an array with all the expected keys but no data for any of them. Extremely frustrating!

This doesn't work (using a primary key named 'jobnumber'):
public function view($jobnumber) {
$this->Job->jobnumber = $jobnumber;
$this->set('job', $this->Job->read());
}

This works (after changing primary key name from 'jobnumber' to 'id' in phpMyAdmin):
public function view($id) {
$this->Job->id = $id;
$this->set('job', $this->Job->read());
}

As you can see, this is the code straight from the blog example.

@ghost
Copy link
Author

ghost commented Oct 11, 2013

30th Oct 2012, Erol Elcan said:


No worrys.
Happy to know you have fixed up.

@AD7six
Copy link
Member

AD7six commented Feb 17, 2014

Closing as this is a (rather common) misunderstanding and not related to this repo.

@AD7six AD7six closed this as completed Feb 17, 2014
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