I don't know why this error is showing, but I can try some little
"hack"
I would try to overide the buildQuery method in your formFilter and
in this method I would compose some better values - some values which
symfony can generate better sql query from
then call the parent::buildQuery() method
I don't know what is "better values" exactly are, but maybe something
like this?:
public function buildQuery(array $values)
{
// create a better value
$values['date'] = $values['year']."-".$values['month']."-".$values
['day'];
// Destroy the old values..
unset($values['year']);
unset($values['month']);
unset($values['day']);
parent::buildQuery($values);
}
On 12 led, 18:06, tirengarfio <[email protected]> wrote:
> Hi,
>
> my error occurs because symfony is generating this (you'll find it in
> my post before):
>
> Doctrine_Connection->execute('SELECT b.id AS b__id, b.day AS
> b__day FROM birthday b WHERE b.day >= ? AND b.day <= ?', array('month'
> => '1', 'day' => '2', 'year' => '2014'))
>
> Ok, the clause is a bit confuse because i called "day" the field of
> Birthday model. If I call it "testdate" this would be the result:
>
> Doctrine_Connection->execute('SELECT b.id AS b__id, b.testdate AS
> b__testdate FROM birthday b WHERE b.testdate >= ? AND b.testdate
> <= ?', array('month'
> => '1', 'day' => '2', 'year' => '2014'))
>
> To the point: i still don't know how to solve this..
>
> Javi
>
> On Jan 5, 2:40 pm, tirengarfio <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I have added this model and this fixture to my app:
>
> > Birthday:
> > columns:
> > day: date
>
> > Birthday:
> > example:
> > day: "2010-1-1"
>
> > I have generated the Birthday module. Then I've generated the filter
> > class (BirthdayFormFilter.class.php) and I have created a form filter
> > object in executeIndex():
>
> > $this->filter = new BirthdayFormFilter();
>
> > After that, i've added this lines to the index template:
>
> > <?php echo form_tag('birthday/filtrar') ?>
> > <?php echo $filter; ?>
> > <div><?php echo submit_tag('Filter') ?></div>
> > </form>
>
> > When i click the 'Filter' button i get this error:
>
> > 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('month' => '1',
> > 'day' => '2', 'year' => '2014'))
> > 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 b.id AS b__id, b.day AS
> > b__day FROM birthday b WHERE b.day >= ? AND b.day <= ?', array('month'
> > => '1', 'day' => '2', 'year' => '2014'))
> > 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('month' => '1', 'day'
> > => '2', 'year' => '2014'))
> > 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/birthday/actions/
> > actions.class.php li
>
> > 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en.