Pimcore\Model\Element\WorkflowState::getByPrimary PHP Method

getByPrimary() public static method

public static getByPrimary ( $cid, $ctype, $workflowId ) : null | WorkflowState
$cid
$ctype
$workflowId
return null | WorkflowState
    public static function getByPrimary($cid, $ctype, $workflowId)
    {
        try {
            $workflowState = new self();
            $workflowState->getDao()->getByPrimary($cid, $ctype, $workflowId);
            return $workflowState;
        } catch (\Exception $e) {
            return null;
        }
    }

Usage Example

Example #1
0
 /**
  * Loads a list of workflow states for the specified parameters, returns an array of Element\WorkflowState elements
  *
  * @return array
  */
 public function load()
 {
     $workflowStateData = $this->db->fetchAll("SELECT cid, ctype, workflowId FROM element_workflow_state" . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     $workflowStates = [];
     foreach ($workflowStateData as $entry) {
         if ($workflowState = Model\Element\WorkflowState::getByPrimary($entry['cid'], $entry['ctype'], $entry['workflowid'])) {
             $workflowStates[] = $workflowState;
         }
     }
     $this->model->setWorkflowStates($workflowStates);
     return $workflowStates;
 }
All Usage Examples Of Pimcore\Model\Element\WorkflowState::getByPrimary