Example #1
0
    /**

     * Create Message-Type-Variable records

     *

     * @param array $arrayData Data

     *

     * return void

     */

    public function createMessageTypeVariable(array $arrayData)

    {

        try {

            $variable = new \ProcessMaker\BusinessModel\MessageType\Variable();





            foreach ($arrayData as $value) {

                $record = $value;



                if ($variable->exists($record["MSGTV_UID"])) {

                    $variable->delete($record["MSGTV_UID"]);

                }



                $result = $variable->singleCreate($record);

            }

        } catch (Exception $e) {

            throw $e;

        }

    }
Example #2
0
 /**
  * Get data of a Message-Type
  *
  * @param string $messageTypeUid Unique id of Message-Type
  * @param bool   $flagGetRecord  Value that set the getting
  *
  * return array Return an array with data of a Message-Type
  */
 public function getMessageType($messageTypeUid, $flagGetRecord = false)
 {
     try {
         //Verify data
         $this->throwExceptionIfNotExistsMessageType($messageTypeUid, $this->arrayFieldNameForException["messageTypeUid"]);
         //Get data
         //SQL
         $criteria = $this->getMessageTypeCriteria();
         $criteria->add(\MessageTypePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
         $rsCriteria = \MessageTypePeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $rsCriteria->next();
         $row = $rsCriteria->getRow();
         //Variable
         $arrayVariable = array();
         $variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
         $variable->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
         $criteriaMessageTypeVariable = $variable->getMessageTypeVariableCriteria();
         $criteriaMessageTypeVariable->add(\MessageTypeVariablePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
         $rsCriteriaMessageTypeVariable = \MessageTypeVariablePeer::doSelectRS($criteriaMessageTypeVariable);
         $rsCriteriaMessageTypeVariable->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteriaMessageTypeVariable->next()) {
             $row2 = $rsCriteriaMessageTypeVariable->getRow();
             if (!$flagGetRecord) {
                 $arrayVariable[] = $variable->getMessageTypeVariableDataFromRecord($row2, false);
             } else {
                 unset($row2["MSGTV_UID"]);
                 $arrayVariable[] = $row2;
             }
         }
         $row["MSGT_VARIABLES"] = $arrayVariable;
         //Return
         return !$flagGetRecord ? $this->getMessageTypeDataFromRecord($row) : $row;
     } catch (\Exception $e) {
         throw $e;
     }
 }