#1566: DQL callback parameter not passed in Timestampable
-----------------------------------+----------------------------------------
Reporter: jphilip | Owner: romanb
Type: defect | Status: new
Priority: major | Milestone: Unknown
Component: Listeners | Version: 1.0.3
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
This happens in the PreDqlUpdate of the Timestampable behavior, but I
think it would affect custom Dql events as well.
The extra parameter for the updated_at field does not get added to the
parameters list of the query casing an error.
One problem is that the getParams method of Abstract_Query returns a
flattened array of params when in this case, we would need to set
_params[set] to keep the order in the flattened array.
I tried to add a getRawParams method to Abstract_Query and update the
_params[set] array, but it did not work:
if ( ! $query->contains($field)) {
$queryParams = $query->getRawParams();
$queryParams['set'][] = $this->getTimestamp('updated');
$query->setParams($queryParams);
$query->set($field, '?');
}
Here is the stack trace:
[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\plugins\sfDoctrinePlugin\lib\doctrine\Doctrine
\Connection.php line 1074 ...
$name <
/span>= 'Doctrine_Connection_'
. $this->driverName . '_Exception';
$exc = new $name($e->getMessage()
, (int) $e->getCode());
if ( ! is_array($e
->errorInfo)) {
$e->errorInfo
;= array(null, null, null, null);
}at Doctrine_Connection- >rethrowException(object('PDOException'),
object('Doctrine_Connection_Statement' ))in
SF_ROOT_DIR\plugins\sfDoctrinePlugin\lib\doctrine\Doctrine\Connection\Statement.php
line 244 ... } catch
;(Doctrine_Adapter_Exception $e) {
}
$this->_conn->rethrowException($e,
$this);
return false
;
}
at Doctrine_Connection_Statement->execute(array('697' , '/client-
files/27/697.jpg', '3027'))in
SF_ROOT_DIR\plugins\sfDoctrinePlugin\lib\doctrine \Doctrine\Connection.php
line 1039 ...
; try {
if ( ! empty
($params)) {
$stmt = $this->prepare($query);
; $stmt->execute($params);
return
$stmt->rowCount();
} else {<
/ol>at Doctrine_Connection->exec('UPDATE dog SET image_id = ?, image_url =
?, updated_at = ? WHERE id = ?', array('697', '/client-files/27/697.jpg',
'3027'))in
SF_ROOT_DIR\plugins\sfDoctrinePlugin\lib\doctrine\Doctrine\Query\Abstract.php
line 940 ... }
if ($this
->_type !== self::SELECT) {
return
;$this->_conn->exec
($query, $params);
}
$stmt <
/span>= $this->_conn-
>execute($query, $params);
at Doctrine_Query_Abstract->_execute(array('697', ' /client-
files/27/697.jpg', '3027'))in
SF_ROOT_DIR\plugins\sfDoctrinePlugin\lib\doctrine\Doctrine
\Query\Abstract.php line 989 ...
; $result
;= $this->_constructQueryFromCache($cached);
}
} else {
$stmt = $this->_execute
($params);
if (is_integer($stmt)) {
$result = $stmt;
at Doctrine_Query_Abstract->execute()in SF_ROOT_DIR
\apps\frontend\modules\ajax\actions\actions.class.php line 456 ...
; ->set('image_id', '?'
, $defaultImage->id)
->set('image_url'
, '?', $defaultImage->getUrl())
->where('id
;= ?', $dogId)
-
>execute();
}
Dog::updateTimestamp($dogId);at
ajaxActions->executeUpdateDogImages()in SF_SYMFONY_LIB_DIR\action
\sfActions.class.php line 53 ...
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1566>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" 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.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---