Magento Magic __set() method acting weird -


magento set function not working other columns except faq_question,faq_answer. primary key keep on incrementing data not inserting columns.

no matter whatever name gave column names keep on showing null. weird thing if manually populate filed , use getfaqjugaad() works. can values database. not set please help. thanks

config.xml

    <?xml version="1.0" encoding="utf-8"?>  <config>     <modules>         <gagan_faq>             <version>0.2.0</version>         </gagan_faq>     </modules>    <frontend>     <routers>         <faq>             <use>standard</use>             <args>                 <module>gagan_faq</module>                 <frontname>faq</frontname>             </args>         </faq>     </routers>    <layout>         <updates>             <faq>                 <file>gaganfaq.xml</file>             </faq>         </updates>     </layout> </frontend>  <global>     <blocks>         <faq>             <class>gagan_faq_block</class>         </faq>     </blocks>     <helpers>         <faq>             <class>gagan_faq_helper</class>         </faq>     </helpers>     <models>         <faq>             <class>gagan_faq_model</class>             <resourcemodel>faq_mysql4</resourcemodel>         </faq>         <faq_mysql4>             <class>gagan_faq_model_mysql4</class>             <entities>                 <dinkchika>                     <table>gagan_faq</table>                 </dinkchika>                 <dinkchika02>                     <table>gagan_faq_creation</table>                 </dinkchika02>             </entities>         </faq_mysql4>     </models>     <resources>         <faq_setup>             <setup>                 <module>gagan_faq</module>             </setup>             <connection>                 <use>core_setup</use>             </connection>         </faq_setup>         <faq_write>             <connection>                 <use>core_write</use>             </connection>         </faq_write>         <faq_read>             <connection>                 <use>core_read</use>             </connection>         </faq_read>     </resources>         </global> 

this install script

<?php   $installer = $this; $installer->startsetup(); $installer->run("   create table if not exists {$this->gettable('faq/dinkchika')} (   `faq_id` int(11) not null auto_increment,   `faq_question` varchar(255) default null,   `faq_answer` varchar(255) default null,   `faq_jugaad` varchar(255) default null,   primary key (`faq_id`) ) engine=innodb default charset=utf8;   ");  $installer->endsetup(); 

indexcontroller

<?php  class gagan_faq_indexcontroller extends mage_core_controller_front_action {     public function indexaction()     {         $this->loadlayout();         $mod = mage::getmodel('faq/faq');         $mod->setfaqquestion('how 5454you?');         $mod->setfaqanswer('gooddsfsfsdfsfdffsd?');         $mod->setfaqjugaad('sfsfdsfsfsdfsfdffsd?');         $mod->save();          $this->renderlayout();     } } 

database table

enter image description here

if magento models don't seem work correctly after running sql setup scripts, e.g. model not saving values fields added sql script, got trapped magento's ddl caching.

amongst other things (like create, index , foreign key statements), magento caches results of time consuming describe table statements. , magento models use such cached results (e.g. when saving) better performance.

now, if whatever reason system fails update ddl cache after running sql script changes tables schemes (alter, add, drop), model still use old cache, not knowing of changes.

unfortunately, none of clear cache buttons/links in magento admin backend allows clear ddl caches on demand. neither explicitely nor implicitely (at least afaik, correct me if i'm wrong).

clear ddl caches

to clear ddl caches, can either use swiss army knife method , manually delete var/cache/* folders. note clear all existing magento's caches, not ddl caches.

or can call varien_db_adapter_pdo_mysql::resetddlcache() or 1 of many derivates, e.g. mage_core_model_resource_setup::getconnection()->resetddlcache().

the resetddlcache() method allows either reset ddl caches single table, or tables @ once. aware though, depends on current state of _isddlcacheallowed property, whether resetting processed.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -