Backend\Modules\FormBuilder\Engine\Model::get PHP Method

get() public static method

Get all data for a given id.
public static get ( integer $id ) : array
$id integer The id for the record to get.
return array
    public static function get($id)
    {
        $return = (array) BackendModel::getContainer()->get('database')->getRecord('SELECT f.* FROM forms AS f WHERE f.id = ?', (int) $id);
        // unserialize the emailaddresses
        if (isset($return['email'])) {
            $return['email'] = (array) unserialize($return['email']);
        }
        return $return;
    }

Usage Example

Example #1
0
 /**
  * @param $params
  */
 public static function afterFormSubmission($params)
 {
     $formId = isset($params['form_id']) ? $params['form_id'] : null;
     if ($formId) {
         $dataId = isset($params['data_id']) ? $params['data_id'] : null;
         if ($dataId) {
             $visitorId = isset($params['visitorId']) ? $params['visitorId'] : null;
             if ($visitorId) {
                 $postedFields = isset($params['fields']) ? $params['fields'] : null;
                 if ($postedFields) {
                     $form = BackendFormBuilderModel::get($formId);
                     if (!empty($form)) {
                         if (isset($form['method']) && $form['method'] == 'database_email') {
                             foreach ($postedFields as $field) {
                                 $value = isset($field['value']) ? unserialize($field['value']) : null;
                                 if ($value) {
                                     if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
                                         self::mailEndUser($value, $postedFields, $form, $dataId);
                                         return;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
All Usage Examples Of Backend\Modules\FormBuilder\Engine\Model::get