2

I have created one custom blog module. For adminpanel Post form i have one field named "identifier". When i save the form all field values getting saved except the "identifier" field.I have tried following too

public function saveAction() {
    if ($data = $this->getRequest()->getPost('post')) {
        try {
            $data = $this->_filterDates($data, array('post_date'));
            $post = $this->_initPost(); 
            $post->setData('identifier', $data['identifier']);
            $post->addData($data);                              
            $post->save();

But not getting saved. Please help me.

  • Did you clear the cache? – Marius Jun 30 '14 at 6:51
  • @Marius , Yes. In live server only i am getting this problem.In local its getting saved when i add $post->setData('identifier', $data['identifier']);. But in live its not working. – Ann Mary Jun 30 '14 at 6:57
  • 2
    This issue usually appears when you add a table field after the module is installed. The table schema is cached even if cache is disabled. Usually, clearing the cache solved the problem. If you are using an alternative way of cacheing (apc, redis, memcached) on the live server make sure you clear that also. restarting the service should do the trick. – Marius Jun 30 '14 at 7:09
  • @Marius, i always delete var/cache folder itself.Is there any problem with that? – Ann Mary Jun 30 '14 at 7:26
  • Don't delete the var/cache folder. Just it's contents. – Marius Jun 30 '14 at 7:30
1

change your code as below

        $data = $this->_filterDates($data, array('post_date'));
        $post = $this->_initPost(); 
        $post->addData($data);                              
        $post->setData('identifier', $data['identifier']);
        $post->save();
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.