0
votes


I have to do this query in my login database's table:

Update user set id_ditta = 1 WHERE id = 6;

I try to do this way (I have already created model):

$changeAz = 1;
$user = 6;

$update = new Criteria();
$where = new Criteria();
$update->add(LoginTableMap::COL_ID_DITTA, $changeAz);
$where->addAnd(LoginTableMap::COL_ID, $user);
$con = Propel::getWriteConnection(\Model\Model\Map\LoginTableMap::DATABASE_NAME);
LoginQuery::create()->doUpdate($update,$where, $con);

The page gives me this error message:

Catchable fatal error: Argument 2 passed to Propel\Runtime\ActiveQuery\ModelCriteria::doUpdate() must implement interface Propel\Runtime\Connection\ConnectionInterface, instance of Propel\Runtime\ActiveQuery\Criteria given, called in C:\xampp\htdocs\work\fiogest\template\verifica\cambiaAzienda.php on line 19 and defined in C:\xampp\htdocs\work\fiogest\vendor\propel\propel\src\Propel\Runtime\ActiveQuery\ModelCriteria.php on line 1695


I think that the page gives me this error because doUpdate method needs two arguments, I try to delete $update or $where but query doesn't work and the page gives me the error message.

How can I do?
Thanks.

1
sorry for my question i have already resolvedMatteo De Blasis

1 Answers

0
votes

Try using something like this:

$changeAz = 1;
$user = 6;

LoginQuery::create()
    ->filterById($user)
    ->update([LoginTableMap::COL_ID_DITTA => $changeAz]);