Documentation shows incorrect EntityModel and Entity calls
Opened this issue · 1 comments
Deleted user commented
The following documentation errors and omissions were noted in the CakeAdvent Calendar Article (no. 5) and the Github Readme for all versions.
- CakeAdvent Article
- Shows incorrect findById() call in function approvePost (near bottom)
- http://josediazgonzalez.com/2013/12/05/objectifying-cakephp-2-0-applications/
- Github Entity Plugin Markdown
- Does not show options for retrieving entities using EntityModel.entity property
CakeAdvent Article
# this call, as documented, does not return entities
$post = $this->findById($post_id);
To get this to work you must do one of the following
# OPT-1: returns entities correctly
$this->entity = true; #set entity property to true before doing findById
$post = $this->findById($post_id);
# ..or..
#OPT-2: returns entities correctly
$post = $this->find('first', ['Post.id' => $post_id], ['entity'=>true]);
Github Entity Plugin Markdown
Documentation on github only includes and example of OPT-2 above and should include the example for OPT-1
$post = $this->find('first', ['Post.id' => $post_id], ['entity'=>true]);
# ..or..
$this->entity = true;
$post = $this->findById($post_id);
josegonzalez commented
Fixered :)