Sounds like you're having some debugging difficulty. Do your best to isolate the problem so you can identify what works and what causes it to stop working.
I assume you're initializing $post
to a model like $post = new Post();
or whatever you called your model. Go into your model and double check that it has a post_title
property defined on the class.
Also, have you tried doing something more in this direction:
$post->post_title = $this->request->getPost('title', null, 'untitled');
Then you'd do:
if (empty($post->post_title)){ $post->post_title = 'title not set'; }
$postDump = print_r(json_decode(json_encode($post)),true);
if ($post->create() == false)
{
echo "create failed<br><pre>$postDump</pre><br>";
foreach ($post->getMessages() as $message) { $a_msg[] = $message; }
} else {
echo 'create successful';
}
Otherwise if you're still getting the message, can you show us where you're calling $post->create()
? Are you doing this in the controller action as well in the same context? Can you hard-code a post_title
rather than grab it from $_POST
? Try these suggestions and get back to us with more information on what's going on.