Programming Language PHP
Namespace Oro\Component\MessageQueue\Job
Class Job
Method/Function setId
Total Examples 1
1 code examples of PHP Oro\Component\MessageQueue\Job\Job::setId extracted from open source projects
private function insertJob(Job $job, EntityManager $em): void
{
$tableName = $em->getClassMetadata(JobEntity::class)->getTableName();
$connection = $em->getConnection();
$qb = $connection->createQueryBuilder();
$qb
->insert($tableName)
->values([
'owner_id' => ':ownerId',
'name' => ':name',
'status' => ':status',
'interrupted' => ':interrupted',
'created_at' => ':createdAt',
'started_at' => ':startedAt',
'stopped_at' => ':stoppedAt',
'last_active_at' => ':lastActiveAt',
'root_job_id' => ':rootJob',
'data' => ':data',
'job_progress' => ':jobProgress',
]);
if ($connection->getDatabasePlatform() instanceof MySqlPlatform) {
$qb->setValue('`unique`', ':unique');
} else {
$qb->setValue('"unique"', ':unique');
}
$qb
->setParameters([
'ownerId' => $job->getOwnerId(),
'name' => $job->getName(),
'status' => $job->getStatus(),
'unique' => (bool) $job->isUnique(),
'interrupted' => (bool) $job->isInterrupted(),
'createdAt' => $job->getCreatedAt(),
'startedAt' => $job->getStartedAt(),
'stoppedAt' => $job->getStoppedAt(),
'lastActiveAt' => $job->getLastActiveAt(),
'rootJob' => $job->getRootJob() ? $job->getRootJob()->getId() : null,
'data' => $job->getData(),
'jobProgress' => $job->getJobProgress(),
], [
'ownerId' => Type::STRING,
'name' => Type::STRING,
'status' => Type::STRING,
'unique' => Type::BOOLEAN,
'interrupted' => Type::BOOLEAN,
'createdAt' => Type::DATETIME,
'startedAt' => Type::DATETIME,
'stoppedAt' => Type::DATETIME,
'lastActiveAt' => Type::DATETIME,
'rootJob' => Type::INTEGER,
'data' => Type::JSON_ARRAY,
'jobProgress' => Type::FLOAT,
]);
$qb->execute();
$job->setId($connection->lastInsertId());
}