Category - Include in Navigation Menu

When updating Magento categories, I found that categories I had exclude in the Navigation Menu reapearred after an update.

Looking at the attributes, I noticed that there was a getter and setter for "Include in Navigation Menu" but even though I wasn't using this, by default any update was enabling this option.

I thought that perhaps this setting was required on save otherwise it used the default and so decided to capture the seting before hand and make sure it was set correctly.

$incInMenu = $fndCat->getIncludeInMenu();
$fndCat->setIncludeInMenu($incInMenu);

But all this appeared to do was change the default to disable this option.  Looking at the result for $incInMenu, is was always returning NULL.

Then I found this information off the web:-

"This is due to Magento lazy loading the category model. Methods like getChildrenCategories() on the Mage_Catalog_Model_Category model returns a collection of category models and Magento only loads the core model data rather than the additional EAV data for each model. The include_in_menu attribute is stored in the EAV data store and has not been loaded.

Therefore with this information, I simple added a single line of code to my extension, after the category was found.  This then meant all attributes were loaded and then on a save after the update, beacuse the values were now present they kept their state and were not reset to any default.

$fndCat->load();

References:
http://stackoverflow.com/questions/8729225/magento-category-model-not-loading-all-data