NerdsAndCompany\Schematic\Services\CategoryGroups::resetCraftCategoriesServiceCache PHP 메소드

resetCraftCategoriesServiceCache() 개인적인 메소드

Reset craft fields service cache using reflection.
    private function resetCraftCategoriesServiceCache()
    {
        $obj = Craft::app()->categories;
        $refObject = new \ReflectionObject($obj);
        if ($refObject->hasProperty('_fetchedAllCategoryGroups')) {
            $refProperty = $refObject->getProperty('_fetchedAllCategoryGroups');
            $refProperty->setAccessible(true);
            $refProperty->setValue($obj, false);
        }
        if ($refObject->hasProperty('_categoryGroupsById')) {
            $refProperty = $refObject->getProperty('_categoryGroupsById');
            $refProperty->setAccessible(true);
            $refProperty->setValue($obj, array());
        }
    }