[Symfony 1.4] Problèmede routage action does not exist ?

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [Symfony 1.4] Problèmede routage action does not exist ?

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par rs232 » 26 mars 2010, 16:29

non j'ai toujours la même erreur,
en ajoutant module: general
et/ou mettant showInfos: ~

Code : Tout sélectionner

generator: class: sfDoctrineGenerator param: model_class: hardware module: general theme: admin non_verbose_templates: true with_show: true singular: ~ plural: ~ route_prefix: hardware with_doctrine_route: true actions_base_class: sfActions
tu ne pense pas qu'il faut que je rajoute des paramètres dans mon routing.yml?
car en faisant add:routes comme tu me la indiqué on trouve

Code : Tout sélectionner

hardware_object GET /general/:idHardware/:action.:sf_format

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par zeus » 26 mars 2010, 16:18

essaye de préciser le nom du module dans le paramètrage de ton admin-gen, ou voir même de ne pas préciser l'action, comme c'est expliqué ici

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par rs232 » 26 mars 2010, 15:59

voila mon generator.yml

Code : Tout sélectionner

generator: class: sfDoctrineGenerator param: model_class: hardware theme: admin non_verbose_templates: true with_show: true singular: ~ plural: ~ route_prefix: hardware with_doctrine_route: true actions_base_class: sfActions config: actions: fields: ~ list: title: Liste des produits sort: {dateProd, asc} object_actions: _edit: { label: Editer } _show: { label: Infos , action: showInfos } actions: ~ max_per_page: 20 filter: ~ form: ~ edit: ~ new: ~
et voici mon routing.yml

Code : Tout sélectionner

hardware: class: sfDoctrineRouteCollection options: model: hardware module: general prefix_path: /general column: idHardware with_wildcard_routes: true homepage: url: / param: { module: default, action: index } default_index: url: /:module param: { action: index } default: url: /:module

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par zeus » 26 mars 2010, 15:51

Ce que je voulais dire, c'est donner l'ensemble de la définition de la route dont la section que tu nous as donné est

Code : Tout sélectionner

object_actions: _edit: { label: Editer } showInfos: { label: Infos , action: showInfos }
Parce que là, cet ajout n'apparait pas dans les routes.

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par rs232 » 26 mars 2010, 15:48

seulement les routes suivantes sont importantes car test et routing sont deux modules que j'ai créé pour effectuer des tests

Code : Tout sélectionner

hardware GET /general.:sf_format hardware_new GET /general/new.:sf_format hardware_create POST /general.:sf_format hardware_edit GET /general/:idHardware/edit.:sf_format hardware_update PUT /general/:idHardware.:sf_format hardware_delete DELETE /general/:idHardware.:sf_format hardware_show GET /general/:idHardware.:sf_format hardware_object GET /general/:idHardware/:action.:sf_format hardware_collection POST /general/:action/action.:sf_format homepage ANY / default_index ANY /:module default ANY /:module

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par rs232 » 26 mars 2010, 15:41

voila pour le app:routes frontend

Code : Tout sélectionner

>> app Current routes for application "frontend" Name Method Pattern hardware_routing GET /routing.:sf_format hardware_routing_new GET /routing/new.:sf_format hardware_routing_create POST /routing.:sf_format hardware_routing_edit GET /routing/:idHardware/edit.:sf_format hardware_routing_update PUT /routing/:idHardware.:sf_format hardware_routing_delete DELETE /routing/:idHardware.:sf_format hardware_routing_show GET /routing/:idHardware.:sf_format hardware_routing_object GET /routing/:idHardware/:action.:sf_format hardware_routing_collection POST /routing/:action/action.:sf_format hardware_test GET /test.:sf_format hardware_test_new GET /test/new.:sf_format hardware_test_create POST /test.:sf_format hardware_test_edit GET /test/:idHardware/edit.:sf_format hardware_test_update PUT /test/:idHardware.:sf_format hardware_test_delete DELETE /test/:idHardware.:sf_format hardware_test_show GET /test/:idHardware.:sf_format hardware_test_object GET /test/:idHardware/:action.:sf_format hardware_test_collection POST /test/:action/action.:sf_format hardware GET /general.:sf_format hardware_new GET /general/new.:sf_format hardware_create POST /general.:sf_format hardware_edit GET /general/:idHardware/edit.:sf_format hardware_update PUT /general/:idHardware.:sf_format hardware_delete DELETE /general/:idHardware.:sf_format hardware_show GET /general/:idHardware.:sf_format hardware_object GET /general/:idHardware/:action.:sf_format hardware_collection POST /general/:action/action.:sf_format homepage ANY / default_index ANY /:module default ANY /:module
sinon je n'ai pas bien compris ce que tu veut en disant:
Donne nous l'ensemble de la route, pas seulement les paramètres que tu as ajoutés.
je n'ai pas modifier le partial _list_td_actions.php généré automatiquement

merci pour ton aide

Re: [Symfony 1.4] Problèmede routage action does not exist ?

par zeus » 26 mars 2010, 13:17

Quand tu appelles la route, avec
<?php echo link_to(__('Infos', array(), 'messages'), 'general/showInfos?id_hardware='.$hardware->getIdHardware(), array()) ?>
tu ne passes pas par la route générée.

Donne nous l'ensemble de la route, pas seulement les paramètres que tu as ajoutés.
De plus, fait un

Code : Tout sélectionner

./symfony app:routes frontend
et poste nous le résultat

[Symfony 1.4] Problèmede routage action does not exist ?

par rs232 » 26 mars 2010, 13:10

bonjour a tous j'ai pratiquement le même problème,

Code : Tout sélectionner

404 | Not Found | sfError404Exception Action "general/action" does not exist.


j'ai cette URL

Code : Tout sélectionner

http://localhost/monprojet/web/frontend_dev.php/general/showInfos/action?id_hardware=2
au lieu de celle ci qui marche trés bien pour exécuter mon action

Code : Tout sélectionner

http://localhost/monprojet/web/frontend_dev.php/general/2/showInfos
dois je modifier mon routing.yml? il est par defaut pour le moment
j'ai juste rajouter dans generator.yml une nouvelle action

Code : Tout sélectionner

object_actions: _edit: { label: Editer } showInfos: { label: Infos , action: showInfos }
ainsi que mon actions dans actions.class.php

Code : Tout sélectionner

public function executeShowInfos (sfWebRequest $request) { $this->hardware = $this->getRoute()->getObject(); $this->setTemplate('showInfos'); }
l'url generé dans mon cache est de la forme suivante

Code : Tout sélectionner

<td> <ul class="sf_admin_td_actions"> <?php echo $helper->linkToEdit($hardware, array( 'label' => 'Editer', 'params' => array( ), 'class_suffix' => 'edit',)) ?> <li class="sf_admin_action_show"> <?php echo link_to(__('Infos', array(), 'messages'), 'general/showInfos?id_hardware='.$hardware->getIdHardware(), array()) ?> </li> </ul> </td>
puis j'ai ce message dans les logs

Code : Tout sélectionner

Match route "hardware_object" (/general/:idHardware/:action.:sf_format) for /general/showInfos/action with parameters array ( 'module' => 'general', 'action' => 'action', 'sf_format' => 'html', 'idHardware' => 'showInfos',)

merci pour votre aide