convertValuesToDatabase() public static method

The input array must have the following layout: array( 'bin' => array() // list of the binary ids. 'value' => array() // list of the uuids. 'path' => array() // list of the paths. )
public static convertValuesToDatabase ( array $values ) : array
$values array The values to convert.
return array
Esempio n. 1
0
 /**
  * Take the data from the system and serialize it for the database.
  *
  * @param mixed $mixValues The data to serialize.
  *
  * @return string An serialized array with binary data or a binary data.
  */
 public function serializeData($mixValues)
 {
     if ($mixValues === null) {
         $mixValues = array('bin' => array(), 'value' => array(), 'path' => array());
     }
     $arrData = ToolboxFile::convertValuesToDatabase($mixValues);
     // Check single file or multiple file.
     if ($this->get('file_multiple')) {
         $mixValues = serialize($arrData);
     } else {
         $mixValues = $arrData[0];
     }
     return $mixValues;
 }
 /**
  * Take the native data and serialize it for the database.
  *
  * @param mixed $mixValues The data to serialize.
  *
  * @return string An serialized array with binary data or a binary data.
  */
 private function convert($mixValues)
 {
     $data = ToolboxFile::convertValuesToDatabase($mixValues);
     // Check single file or multiple file.
     if ($this->get('file_multiple')) {
         return serialize($data);
     }
     return isset($data[0]) ? $data[0] : null;
 }