Ejemplo n.º 1
0
 public function executeMakePrimaryAlias($request)
 {
     if (!$request->isMethod('post')) {
         $this->forward('error', 'invalid');
     }
     $alias = Doctrine::getTable('Alias')->find($request->getParameter('id'));
     $this->forward404Unless($alias);
     $alias->makePrimary();
     //comprehensive cache clearing due to changed primary alias
     $this->clearCache($alias->Entity);
     $entity_relationships = $alias->Entity->getEntitiesWithRelationships();
     $patterns = array();
     foreach ($entity_relationships as $order => $categoryIds) {
         foreach ($categoryIds as $categoryId => $entityIds) {
             foreach ($entityIds as $entityId => $entityAry) {
                 $patterns = array_merge($patterns, LsCache::getEntityCachePatternsById($entityId));
                 foreach ($entityAry['rels'] as $rel) {
                     $patterns = array_merge($patterns, LsCache::getRelationshipCachePatternsById($rel['id']));
                 }
             }
         }
     }
     LsCache::clearCachePatterns($patterns);
     $this->redirect($alias->Entity->getInternalUrl('editAliases'));
 }