/**
* {@inheritdoc}
*/
public function execute(LoggerInterface $logger)
{
// update field itself
$sql = "UPDATE oro_entity_config_index_value\n SET value = ?\n WHERE\n entity_id = (SELECT id FROM oro_entity_config WHERE class_name = ? LIMIT 1) AND\n field_id IS NULL AND\n scope = ? AND\n code = ?\n ";
$parameters = [$this->value, $this->entityName, $this->scope, $this->code];
$statement = $this->connection->prepare($sql);
$statement->execute($parameters);
$this->logQuery($logger, $sql, $parameters);
$logger->debug($sql);
// update entity config cached data
$sql = 'SELECT data FROM oro_entity_config WHERE class_name = ? LIMIT 1';
$parameters = [$this->entityName];
$data = $this->connection->fetchColumn($sql, $parameters);
$this->logQuery($logger, $sql, $parameters);
$data = $data ? $this->connection->convertToPHPValue($data, Type::TARRAY) : [];
$data[$this->scope][$this->code] = $this->value;
$data = $this->connection->convertToDatabaseValue($data, Type::TARRAY);
$sql = 'UPDATE oro_entity_config SET data = ? WHERE class_name = ?';
$parameters = [$data, $this->entityName];
$statement = $this->connection->prepare($sql);
$statement->execute($parameters);
$this->logQuery($logger, $sql, $parameters);
}