/** * Overriding to prefix the key with model name * @param string $key * @param array $data */ public static function setDataByKeyAndData($key, array $data) { parent::setDataByKeyAndData('report_' . $key, $data); }
public function testRestoreSelectedOptionsAsStickyData() { $key = MashableUtil::resolveKeyByModuleAndModel('MashableInboxModule', 'testClassName'); StickyUtil::clearDataByKey($key); $mashableInboxForm = MashableUtil::restoreSelectedOptionsAsStickyData('testClassName'); $mashableInboxFormForCompare = new MashableInboxForm(); $this->assertEquals($mashableInboxFormForCompare->attributes, $mashableInboxForm->attributes); $testData = array('optionForModel' => 'aaaaa', 'filteredBy' => 'bbbbb', 'searchTerm' => 'ccccc'); $key = MashableUtil::resolveKeyByModuleAndModel('MashableInboxModule', 'testClassName'); StickyUtil::clearDataByKey($key); StickyUtil::setDataByKeyAndData($key, $testData); $mashableInboxForm = MashableUtil::restoreSelectedOptionsAsStickyData('testClassName'); $this->assertEquals($testData, array_intersect($testData, StickyUtil::getDataByKey($key))); }
public static function resolveSortFromStickyData($getArrayPrefixName, $uniqueLayoutId) { $key = $uniqueLayoutId; $sortAttribute = static::resolveSortAttributeFromGetArray($getArrayPrefixName); $sortDescending = static::resolveSortDescendingFromGetArray($getArrayPrefixName); if (!$sortAttribute) { $stickyData = StickyUtil::getDataByKey($key); $sortAttribute = $stickyData[0]; $sortDescending = $stickyData[1] ? $stickyData[1] : false; return array($sortAttribute, $sortDescending); } StickyUtil::setDataByKeyAndData($key, array($sortAttribute, $sortDescending)); return array($sortAttribute, $sortDescending); }
public static function restoreSelectedOptionsAsStickyData($modelClassName) { assert('strlen($modelClassName) > 0 || ($modelClassName === null)'); $key = self::resolveKeyByModuleAndModel('MashableInboxModule', $modelClassName); $data = StickyUtil::getDataByKey($key); $mashableInboxForm = new MashableInboxForm(); $mashableInboxForm->attributes = $data; return $mashableInboxForm; }