45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Subclass for performing query and update operations on the 'st_task_scheluder_task' table.
|
|
*
|
|
*
|
|
*
|
|
* @package plugins.stTaskPlugin.lib.model
|
|
*/
|
|
class TaskPeer extends BaseTaskPeer
|
|
{
|
|
/**
|
|
* Zwraca listę statusów
|
|
*
|
|
* @return array
|
|
*/
|
|
public static function getStatuses()
|
|
{
|
|
$i18n = sfContext::getInstance()->getI18N();
|
|
return array(
|
|
stTask::STATUS_PENDING => $i18n->__('Oczekuje'),
|
|
stTask::STATUS_RUNNING => $i18n->__('W trakcie wykonywania'),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Zwraca zadanie po jego id
|
|
*
|
|
* @param string $taskId Id zadania
|
|
* @return Task
|
|
*/
|
|
public static function retrieveByTaskId(string $taskId)
|
|
{
|
|
$fc = stFunctionCache::getInstance('stTaskScheluder');
|
|
|
|
return $fc->cacheCall(function($taskId) {
|
|
$c = new Criteria();
|
|
$c->add(self::TASK_ID, $taskId);
|
|
$task = self::doSelectOne($c);
|
|
|
|
return $task;
|
|
}, array($taskId), array('id' => $taskId));
|
|
}
|
|
}
|