Hi,

im trying to add a filter to an index.php page of my module "job".

These are my steps:

In the index.php function I have added the line "$this->filtro = new
JobeetJobFormFilter();". This is the final index.php file:

   $this->jobeet_job_list = Doctrine::getTable('JobeetJob')
    $this->createQuery('a')
    $this->execute();
    $this->filtro = new JobeetJobFormFilter();

I have also added these lines to the indexSuccess.php template:

<form action="<?php echo url_for('job/filter'); ?>" method="post">
<?php echo $filtro ?>
 <p>
  <input class="ui-state-default ui-corner-all" type="submit"
value="Filtrar" />
 </p>
</form>

And then i have created this method below:

public function executeFilter(sfWebRequest $request)
{
  $this->filtro = new JobeetJobFormFilter();
  $this->consulta = $this->filtro->buildQuery($request->getParameter
('jobeet_job_filters'));
  $this->jobeet_job_list = $this->consulta->execute();
  $this->setTemplate('index');
}


When i push filter i get this error message below.

500 | Internal Server Error | Doctrine_Connection_Mysql_Exception
SQLSTATE[HY093]: Invalid parameter number: number of bound variables
does not match number of tokens
stack trace

    * at ()
      in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/
lib/vendor/doctrine/Doctrine/Connection.php line 1086 ...
            1083.
            1084.         $name = 'Doctrine_Connection_' . $this-
>driverName . '_Exception';
            1085.
            1086.         $exc  = new $name($e->getMessage(), (int) $e-
>getCode());
            1087.         if ( ! isset($e->errorInfo) || ! is_array($e-
>errorInfo)) {
            1088.             $e->errorInfo = array(null, null, null,
null);
            1089.         }
    * at Doctrine_Connection->rethrowException(object('PDOException'),
object('Doctrine_Connection_Statement'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/
lib/vendor/doctrine/Doctrine/Connection/Statement.php line 253 ...
             250.         } catch (Doctrine_Adapter_Exception $e) {
             251.         }
             252.
             253.         $this->_conn->rethrowException($e, $this);
             254.
             255.         return false;
             256.     }
    * at Doctrine_Connection_Statement->execute(array('%fer%', 'month'
=> '', 'day' => '', 'year' => ''))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/
lib/vendor/doctrine/Doctrine/Connection.php line 1014 ...
            1011.         try {
            1012.             if ( ! empty($params)) {
            1013.                 $stmt = $this->prepare($query);
            1014.                 $stmt->execute($params);
            1015.
            1016.                 return $stmt;
            1017.             } else {
    * at Doctrine_Connection->execute('SELECT p.id AS p__id,
p.sf_guard_user_id AS p__sf_guard_user_id, p.nombre_apellidos AS
p__nombre_apellidos, p.sexo AS p__sexo, p.fecha_nac AS p__fecha_nac,
p.provincia AS p__provincia, p.localidad AS p__localidad, p.email AS
p__email, p.fotografia AS p__fotografia FROM profile p WHERE
p.nombre_apellidos LIKE ? AND p.fecha_nac >= ? AND p.fecha_nac <= ?',
array('%fer%', 'month' => '', 'day' => '', 'year' => ''))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/
lib/vendor/doctrine/Doctrine/Query/Abstract.php line 992 ...
             989.             return $this->_conn->exec($query,
$params);
             990.         }
             991.
             992.         $stmt = $this->_conn->execute($query,
$params);
             993.         return $stmt;
             994.     }
 995.
    * at Doctrine_Query_Abstract->_execute(array('%fer%', 'month' =>
'', 'day' => '', 'year' => ''))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/
lib/vendor/doctrine/Doctrine/Query/Abstract.php line 1036 ...
            1033.                 $result = $this-
>_constructQueryFromCache($cached);
            1034.             }
            1035.         } else {
            1036.             $stmt = $this->_execute($params);
            1037.
            1038.             if (is_integer($stmt)) {
            1039.                 $result = $stmt;
    * at Doctrine_Query_Abstract->execute()
      in SF_ROOT_DIR/apps/frontend/modules/profile/actions/
actions.class.php line 76 ...
              73. {
              74.   $this->filtro = new ProfileFormFilter();
              75.   $this->consulta = $this->filtro->buildQuery
($request->getParameter('profile_filters'));
              76.   $this->profile_list = $this->consulta->execute();
              77.   $this->setTemplate('index');
              78. }
  79.
    * at profileActions->executeFilter(object('sfWebRequest'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/action/sfActions.class.php
line 60 ...
              57.     }
              58.
              59.     // run action
              60.     return $this->$actionToRun($request);
              61.   }
              62. }
  63.
    * at sfActions->execute(object('sfWebRequest'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfExecutionFilter.class.php line 90 ...
              87.   {
              88.     // execute the action
              89.     $actionInstance->preExecute();
              90.     $viewName = $actionInstance->execute($this-
>context->getRequest());
              91.     $actionInstance->postExecute();
              92.
              93.     return is_null($viewName) ? sfView::SUCCESS :
$viewName;
    * at sfExecutionFilter->executeAction(object('profileActions'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfExecutionFilter.class.php line 76 ...
              73.       return sfView::SUCCESS;
              74.     }
              75.
              76.     return $this->executeAction($actionInstance);
              77.   }
              78.
              79.   /**
    * at sfExecutionFilter->handleAction(object('sfFilterChain'),
object('profileActions'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfExecutionFilter.class.php line 42 ...
              39.     {
              40.       $timer = sfTimerManager::getTimer(sprintf
('Action "%s/%s"', $actionInstance->getModuleName(), $actionInstance-
>getActionName()));
              41.
              42.       $viewName = $this->handleAction($filterChain,
$actionInstance);
              43.
              44.       $timer->addTime();
              45.       $timer = sfTimerManager::getTimer(sprintf
('View "%s" for "%s/%s"', $viewName, $actionInstance->getModuleName(),
$actionInstance->getActionName()));
    * at sfExecutionFilter->execute(object('sfFilterChain'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfFilterChain.class.php line 53 ...
              50.       }
              51.
              52.       // execute the next filter
              53.       $this->chain[$this->index]->execute($this);
              54.     }
              55.   }
  56.
    * at sfFilterChain->execute()
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfCommonFilter.class.php line 29 ...
              26.   public function execute($filterChain)
              27.   {
              28.     // execute next filter
              29.     $filterChain->execute();
              30.
              31.     // execute this filter only once
              32.     $response = $this->context->getResponse();
    * at sfCommonFilter->execute(object('sfFilterChain'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfFilterChain.class.php line 53 ...
              50.       }
              51.
              52.       // execute the next filter
              53.       $this->chain[$this->index]->execute($this);
              54.     }
              55.   }
  56.
    * at sfFilterChain->execute()
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfRenderingFilter.class.php line 33 ...
              30.   public function execute($filterChain)
              31.   {
              32.     // execute next filter
              33.     $filterChain->execute();
              34.
              35.     // get response object
              36.     $response = $this->context->getResponse();
    * at sfRenderingFilter->execute(object('sfFilterChain'))
      in SF_ROOT_DIR/lib/vendor/symfony/lib/filter/
sfFilterChain.class.php line 53 ...
              50.       }
              51.
              52.       // execute the next filter
              53.       $this->chain[$this->index]->execute($this);
              54.     }
              55.   }
  56.
    * at sfFilterChain->execute()
      in SF_ROOT_DIR/lib/vendor/symfony/lib/controller/
sfController.class.php line 245 ...
             242.       }
             243.
             244.       // process the filter chain
             245.       $filterChain->execute();
             246.     }
             247.     else
             248.     {
    * at sfController->forward('profile', 'filter')
      in SF_ROOT_DIR/lib/vendor/symfony/lib/controller/
sfFrontWebController.class.php line 48 ...
              45.       }
              46.
              47.       // make the first request
              48.       $this->forward($moduleName, $actionName);
              49.     }
              50.     catch (sfException $e)
              51.     {
    * at sfFrontWebController->dispatch()
      in SF_ROOT_DIR/lib/vendor/symfony/lib/util/sfContext.class.php
line 159 ...
             156.    */
             157.   public function dispatch()
             158.   {
             159.     $this->getController()->dispatch();
             160.   }
             161.
             162.   /**
    * at sfContext->dispatch()
      in SF_ROOT_DIR/web/frontend_dev.php line 13 ...


Any idea

Javi



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to