Wednesday, February 27, 2013

CakePHP 2.3.0 tutorial blog: Model file name and validation problems

I'm trying to learn CakePHP by doing tutorial blog (but that tutorial is 2.2 -
mayby that's the problem) and I'm having two problems.

When I name model file as Post.php, then every page outputs model at the top
of web page.
Like this:
class Post extends AppModel { public $validate = array( 'title' =>
array( 'rule' => 'notEmpty' ), 'body' => array( 'rule' => 'notEmpty' ) );
} class Post extends AppModel { public $validate = array( 'title' =>
array( 'rule' => 'notEmpty' ), 'body' => array( 'rule' => 'notEmpty' ) ); }
Also, when I add new post or delete post, then browser remains on a page,
that displays that model source on white background.
When I rename model file to post.php, then I don't get that model output
and deleting/adding post correcly redirects to index page.
But from what I understand, the model file is supposed to be named Post.php.
And that output does not depend debug settings.

Another problem is, that no matter what is the filename of model,
validation is never done.


PS: I'm using tutorial from
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html


--
Virgo Pärna
virgo.parna@mail.ee

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: