| @@ 281-317 (lines=37) @@ | ||
| 278 | * |
|
| 279 | * @param \eZ\Publish\SPI\Persistence\Content\ObjectState $objectState |
|
| 280 | */ |
|
| 281 | public function updateObjectState(ObjectState $objectState) |
|
| 282 | { |
|
| 283 | // First update the state |
|
| 284 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 285 | $query->update( |
|
| 286 | $this->dbHandler->quoteTable('ezcobj_state') |
|
| 287 | )->set( |
|
| 288 | $this->dbHandler->quoteColumn('default_language_id'), |
|
| 289 | $query->bindValue( |
|
| 290 | $this->maskGenerator->generateLanguageIndicator($objectState->defaultLanguage, false), |
|
| 291 | null, |
|
| 292 | \PDO::PARAM_INT |
|
| 293 | ) |
|
| 294 | )->set( |
|
| 295 | $this->dbHandler->quoteColumn('identifier'), |
|
| 296 | $query->bindValue($objectState->identifier) |
|
| 297 | )->set( |
|
| 298 | $this->dbHandler->quoteColumn('language_mask'), |
|
| 299 | $query->bindValue( |
|
| 300 | $this->maskGenerator->generateLanguageMaskFromLanguageCodes($objectState->languageCodes, true), |
|
| 301 | null, |
|
| 302 | \PDO::PARAM_INT |
|
| 303 | ) |
|
| 304 | )->where( |
|
| 305 | $query->expr->eq( |
|
| 306 | $this->dbHandler->quoteColumn('id'), |
|
| 307 | $query->bindValue($objectState->id, null, \PDO::PARAM_INT) |
|
| 308 | ) |
|
| 309 | ); |
|
| 310 | ||
| 311 | $query->prepare()->execute(); |
|
| 312 | ||
| 313 | // And then refresh object state translations |
|
| 314 | // by removing existing ones and adding new ones |
|
| 315 | $this->deleteObjectStateTranslations($objectState->id); |
|
| 316 | $this->insertObjectStateTranslations($objectState); |
|
| 317 | } |
|
| 318 | ||
| 319 | /** |
|
| 320 | * Deletes object state identified by $stateId. |
|
| @@ 431-467 (lines=37) @@ | ||
| 428 | * |
|
| 429 | * @param \eZ\Publish\SPI\Persistence\Content\ObjectState\Group $objectStateGroup |
|
| 430 | */ |
|
| 431 | public function updateObjectStateGroup(Group $objectStateGroup) |
|
| 432 | { |
|
| 433 | // First update the group |
|
| 434 | $query = $this->dbHandler->createUpdateQuery(); |
|
| 435 | $query->update( |
|
| 436 | $this->dbHandler->quoteTable('ezcobj_state_group') |
|
| 437 | )->set( |
|
| 438 | $this->dbHandler->quoteColumn('default_language_id'), |
|
| 439 | $query->bindValue( |
|
| 440 | $this->maskGenerator->generateLanguageIndicator($objectStateGroup->defaultLanguage, false), |
|
| 441 | null, |
|
| 442 | \PDO::PARAM_INT |
|
| 443 | ) |
|
| 444 | )->set( |
|
| 445 | $this->dbHandler->quoteColumn('identifier'), |
|
| 446 | $query->bindValue($objectStateGroup->identifier) |
|
| 447 | )->set( |
|
| 448 | $this->dbHandler->quoteColumn('language_mask'), |
|
| 449 | $query->bindValue( |
|
| 450 | $this->maskGenerator->generateLanguageMaskFromLanguageCodes($objectStateGroup->languageCodes, true), |
|
| 451 | null, |
|
| 452 | \PDO::PARAM_INT |
|
| 453 | ) |
|
| 454 | )->where( |
|
| 455 | $query->expr->eq( |
|
| 456 | $this->dbHandler->quoteColumn('id'), |
|
| 457 | $query->bindValue($objectStateGroup->id, null, \PDO::PARAM_INT) |
|
| 458 | ) |
|
| 459 | ); |
|
| 460 | ||
| 461 | $query->prepare()->execute(); |
|
| 462 | ||
| 463 | // And then refresh group translations |
|
| 464 | // by removing old ones and adding new ones |
|
| 465 | $this->deleteObjectStateGroupTranslations($objectStateGroup->id); |
|
| 466 | $this->insertObjectStateGroupTranslations($objectStateGroup); |
|
| 467 | } |
|
| 468 | ||
| 469 | /** |
|
| 470 | * Deletes the object state group identified by $groupId. |
|