CRM V2

Question extends CrmClientModel
in package

This class represents a question It has some static methods to retrieve questions and answers

Tags
category

Api Models

subpackage

models

Table of Contents

$answers  : array<string|int, Answer>
$id  : string
$question  : string
$type  : QuestionType
$modelFields  : array<string|int, mixed>
The crm customer fields
$validation  : array<string|int, mixed>
Validation rules
$answers  : array<string|int, Answer>
The question answers
$id  : int
The question id
$isNew  : bool
Is true if this model was not filled from crm
$question  : string
The actual question as a string
$type  : QuestionType
The question type
__construct()  : mixed
__get()  : mixed
__set()  : mixed|null
Set prop
all()  : array<string|int, mixed>
Get all questions only
allWithCustomerAnswers()  : array<string|int, mixed>
Get all the questions with customer answers
fill()  : void
Fill data into this model using validation rules
jsonSerialize()  : array<string|int, mixed>
Serialize this object to an array
unansweredBy()  : array<string|int, Question>
Get unanswered question for a specific customer
validateAllValues()  : array<string|int, mixed>
Validate all model properties

Properties

$answers

public array<string|int, Answer> $answers

An array with answers

$question

public string $question

The actual question as a string

$type

public QuestionType $type

The question type to display, it also hints wether it can accept one or multiple responses, so only checkbox allows multiple responses

$modelFields

The crm customer fields

protected array<string|int, mixed> $modelFields = ['id', 'question', 'type', 'answers']

$validation

Validation rules

protected static array<string|int, mixed> $validation = ['id' => 'required|int', 'question' => 'required|string|max:255', 'type' => ['required'], 'answers' => 'required|array']

$answers

The question answers

private array<string|int, Answer> $answers = []

$id

The question id

private int $id

Required Field Type bigInt

$isNew

Is true if this model was not filled from crm

private bool $isNew = true

$question

The actual question as a string

private string $question = null

Required Max length 255 Field Type varchar

$type

The question type

private QuestionType $type = null

Validate: in QuestionType::toValues()

Required Field Type tinyInteger

Methods

__construct()

public __construct([array<string|int, mixed> $properties = [] ]) : mixed
Parameters
$properties : array<string|int, mixed> = []
Return values
mixed —

__get()

public __get(string $field) : mixed
Parameters
$field : string
Return values
mixed —

__set()

Set prop

public __set(string $field, mixed $value) : mixed|null
Parameters
$field : string
$value : mixed
Tags
throws
TypeError

if the field has an incorrect value

Return values
mixed|null —

The input value or null is this prop does not exists

all()

Get all questions only

public static all() : array<string|int, mixed>
Tags
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
array<string|int, mixed> —

with \LDC\LDCCRM\Models\Question[]

allWithCustomerAnswers()

Get all the questions with customer answers

public static allWithCustomerAnswers(Customer $customer) : array<string|int, mixed>
Parameters
$customer : Customer
Tags
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
array<string|int, mixed> —

[ 0 => [ 'question' => \LDC\LDCCRM\Models\Question, 'customerAnswers' => \LDC\LDCCRM\Models\Answer[] ] ]

with \LDC\LDCCRM\Models\Question[] and the customer \LDC\LDCCRM\Models\Answer[]

fill()

Fill data into this model using validation rules

public fill(array<string|int, mixed> $properties) : void
Parameters
$properties : array<string|int, mixed>
Tags
throws
TypeError

if any valid is not validated

Return values
void —

jsonSerialize()

Serialize this object to an array

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —

unansweredBy()

Get unanswered question for a specific customer

public static unansweredBy(Customer $customer) : array<string|int, Question>
Parameters
$customer : Customer
Tags
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
array<string|int, Question> —

validateAllValues()

Validate all model properties

protected validateAllValues([array<string|int, mixed> $ignore = [] ]) : array<string|int, mixed>
Parameters
$ignore : array<string|int, mixed> = []
Return values
array<string|int, mixed> —

the validated values

Search results