ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 9890


Ignore:
Timestamp:
Jan 4, 2009, 10:29:03 PM (11 years ago)
Author:
ogawa
Message:

changed routing class to put in order of priority the routing rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opDiaryPlugin/trunk/lib/opDiaryPluginRouting.class.php

    r9876 r9890  
    1212  {
    1313    $routing = $event->getSubject();
    14     $routing->prependRoute('diary_delete_default',
    15       new sfRoute(
    16         '/diary/*',
    17         array('module' => 'default', 'action' => 'error')
    18       )
    19     );
    20     $routing->prependRoute('diary_index',
    21       new sfRoute(
     14
     15    $routes = array(
     16      'diary_index' => new sfRoute(
    2217        '/diary',
    2318        array('module' => 'diary', 'action' => 'index')
    24       )
    25     );
    26     $routing->prependRoute('diary_list',
    27       new sfRoute(
     19      ),
     20
     21      'diary_list' => new sfRoute(
    2822        '/diary/list',
    2923        array('module' => 'diary', 'action' => 'list')
    30       )
    31     );
    32     $routing->prependRoute('diary_list_member',
    33       new sfPropelRoute(
     24      ),
     25      'diary_list_member' => new sfPropelRoute(
    3426        '/diary/listMember/:id',
    3527        array('module' => 'diary', 'action' => 'listMember'),
    3628        array('id' => '\d+'),
    3729        array('model' => 'Member', 'type' => 'object')
    38       )
    39     );
    40     $routing->prependRoute('diary_list_friend',
    41       new sfRoute(
     30      ),
     31      'diary_list_friend' => new sfRoute(
    4232        '/diary/listFriend',
    4333        array('module' => 'diary', 'action' => 'listFriend')
    44       )
    45     );
    46     $routing->prependRoute('diary_show',
    47       new sfPropelRoute(
     34      ),
     35      'diary_show' => new sfPropelRoute(
    4836        '/diary/:id',
    4937        array('module' => 'diary', 'action' => 'show'),
    5038        array('id' => '\d+'),
    5139        array('model' => 'Diary', 'type' => 'object')
    52       )
    53     );
    54     $routing->prependRoute('diary_new',
    55       new sfRoute(
     40      ),
     41
     42      'diary_new' => new sfRoute(
    5643        '/diary/new',
    5744        array('module' => 'diary', 'action' => 'new')
    58       )
    59     );
    60     $routing->prependRoute('diary_create',
    61       new sfRoute(
     45      ),
     46      'diary_create' => new sfRoute(
    6247        '/diary/create',
    6348        array('module' => 'diary', 'action' => 'create'),
    6449        array('sf_method' => array('post'))
    65       )
    66     );
    67     $routing->prependRoute('diary_edit',
    68       new sfPropelRoute(
     50      ),
     51      'diary_edit' => new sfPropelRoute(
    6952        '/diary/edit/:id',
    7053        array('module' => 'diary', 'action' => 'edit'),
    7154        array('id' => '\d+'),
    7255        array('model' => 'Diary', 'type' => 'object')
    73       )
    74     );
    75     $routing->prependRoute('diary_update',
    76       new sfPropelRoute(
     56      ),
     57      'diary_update' => new sfPropelRoute(
    7758        '/diary/update/:id',
    7859        array('module' => 'diary', 'action' => 'update'),
    7960        array('id' => '\d+', 'sf_method' => array('post')),
    8061        array('model' => 'Diary', 'type' => 'object')
    81       )
    82     );
    83     $routing->prependRoute('diary_delete_confirm',
    84       new sfPropelRoute(
     62      ),
     63      'diary_delete_confirm' => new sfPropelRoute(
    8564        '/diary/deleteConfirm/:id',
    8665        array('module' => 'diary', 'action' => 'deleteConfirm'),
    8766        array('id' => '\d+'),
    8867        array('model' => 'Diary', 'type' => 'object')
    89       )
    90     );
    91     $routing->prependRoute('diary_delete',
    92       new sfPropelRoute(
     68      ),
     69      'diary_delete' => new sfPropelRoute(
    9370        '/diary/delete/:id',
    9471        array('module' => 'diary', 'action' => 'delete'),
    9572        array('id' => '\d+', 'sf_method' => array('post')),
    9673        array('model' => 'Diary', 'type' => 'object')
    97       )
    98     );
    99     $routing->prependRoute('diary_comment_create',
    100       new sfPropelRoute(
     74      ),
     75
     76      'diary_comment_create' => new sfPropelRoute(
    10177        '/diary/:id/comment/create',
    10278        array('module' => 'diaryComment', 'action' => 'create'),
    10379        array('id' => '\d+', 'sf_method' => array('post')),
    10480        array('model' => 'Diary', 'type' => 'object')
    105       )
    106     );
    107     $routing->prependRoute('diary_comment_delete_confirm',
    108       new sfPropelRoute(
     81      ),
     82      'diary_comment_delete_confirm' => new sfPropelRoute(
    10983        '/diary/comment/deleteConfirm/:id',
    11084        array('module' => 'diaryComment', 'action' => 'deleteConfirm'),
    11185        array('id' => '\d+'),
    11286        array('model' => 'DiaryComment', 'type' => 'object')
    113       )
    114     );
    115     $routing->prependRoute('diary_comment_delete',
    116       new sfPropelRoute(
     87      ),
     88      'diary_comment_delete' => new sfPropelRoute(
    11789        '/diary/comment/delete/:id',
    11890        array('module' => 'diaryComment', 'action' => 'delete'),
    11991        array('id' => '\d+', 'sf_method' => array('post')),
    12092        array('model' => 'DiaryComment', 'type' => 'object')
    121       )
     93      ),
     94
     95      'diary_nodefaults' => new sfRoute(
     96        '/diary/*',
     97        array('module' => 'default', 'action' => 'error')
     98      ),
    12299    );
     100
     101    $routes = array_reverse($routes);
     102    foreach ($routes as $name => $route)
     103    {
     104      $routing->prependRoute($name, $route);
     105    }
    123106  }
    124107}
Note: See TracChangeset for help on using the changeset viewer.