Question class definition

This class has been auto-generated by the Doctrine ORM Framework

package Webenq_Models
author Bart Huttinga
subpackage
version SVN: $Id: Builder.php,v 1.2 2011/07/12 13:39:03 bart Exp $

 Methods

Adds an answer to the current question

addAnswer(\Webenq_Model_Answer | string $answer, \Respondent $respondent) : \Webenq_Model_Question
fluent This method is part of a fluent interface and will return the same instance

Parameters

$answer

\Webenq_Model_Answerstring

$respondent

\Respondent

Returns

Adds a collection of answers to the current question

addAnswers(array $answers, array $respondents) : \Webenq_Model_Question
fluent This method is part of a fluent interface and will return the same instance

Parameters

$answers

array

$respondents

array

Returns

Add a type that has not been validated

addInvalidType(string $invalidType) 

Parameters

$invalidType

string

Class names

Add an array of types that have not been validated

addInvalidTypes(array $invalidTypes) 

Parameters

$invalidTypes

array

Array of valid class names

Sets the question text for a given language

addQuestionText(string $language, string $text) : \Webenq_Model_Question
fluent This method is part of a fluent interface and will return the same instance

Parameters

$language

string

The language to set the text for

$text

string

The question text for the given language

Returns

Sets the question texts for every language

addQuestionTexts(array $texts) : \Webenq_Model_Question
fluent This method is part of a fluent interface and will return the same instance

Parameters

$texts

array

Array with language codes as keys and question texts as values

Returns

Add a type that has been validated

addValidType(string $validType) 

Parameters

$validType

string

Class names

Add an array of types that have been validated

addValidTypes(array $validTypes) 

Parameters

$validTypes

array

Array of valid class names

Checks if at least one answer is not-empty

answersGiven(array $values) : bool
Static

Parameters

$values

array

Array with values

Returns

boolTrue if any answers, false otherwise

autocomplete()

autocomplete($term, $lang, $limit) 
Static

Parameters

$term

$lang

$limit

Counts the number of values

count() : int

Returns

intNumber of values

Counts the number of unique values

countUnique() : int

Returns

intNumber of unique values

Counts the number of unique values, excluding null values

countUniqueExcludingNullValues() : int

Returns

intNumber of unique values

Finds the maximum difference in length of the values

diffLen() : int

Returns

intDifference in length

Factors a question object of the right type

factory(array $answers, string $language) : \Webenq_Model_Question
Static

The provided data is used for detecting the proper question type, but is not included in the returned question object because answers can only be added to questions that are connected to a questionnaire (which is beyond the scope of this factory).

Parameters

$answers

array

Array of answer values to test against

$language

string

Returns

findByQuestionText()

findByQuestionText($questionText, $language) 
Static

Parameters

$questionText

$language

Returns the answer values

getAnswerValues() : array

Returns

arrayAn array with answer values

Gets all types for which this question would not validate

getInvalidTypes() : array

Returns

array

Gets the question text in the given, current or preferred language

getQuestionText(string $language) : \Webenq_Model_QuestionText

Parameters

$language

string

Exceptions

\Exception

Returns

Returns the questionnaires using this question

getQuestionnaires() : \Doctrine_Collection

Returns

\Doctrine_Collection

Returns unique values

getUniqueValues() : array

Returns

array

Returns unique values

getUniqueValuesExcludingNullValues() : array

Returns

array

Gets all types for which this question would validate

getValidTypes() : array

Returns

array

Determines whether the values are numeric values only

isNumeric() : bool

Returns

boolTrue or false

Checks if the given set of answers validates for this question type

isType(\Webenq_Model_Question $question, string $language) : bool
Static

Parameters

$question

\Webenq_Model_Question

A question object containing the data to test against

$language

string

Returns

boolTrue if is this type, false otherwise

Finds the length of the value with the biggest lenth

maxLen() : int

Returns

intLength of the value with the biggest length

Finds the biggest value

maxVal() : string

Returns

stringBiggest value

Finds the length of the value with the smallest lenth

minLen() : int

Returns

intLength of the value with the smallest length

Finds the smallest value

minVal() : string

Returns

stringSmallest value

preInsert()

preInsert($event) 

Parameters

$event

Sets the answer values

setAnswerValues(array $answers) 

Parameters

$answers

array

An array with answer values

Sets the types for which the data would not validate

setInvalidTypes(array $types) 

Parameters

$types

array

Array of class names

setQuestionnaire()

setQuestionnaire(\Questionnaire $questionnaire) 

Parameters

$questionnaire

setTableDefinition()

setTableDefinition() 
Inherited
inherited_from \Webenq_Model_Base_Question::setTableDefinition()

setUp()

setUp() 
Inherited
inherited_from \Webenq_Model_Base_Question::setUp()

Sets the types for which the data would validate

setValidTypes(array $types) 

Parameters

$types

array

Array of class names

Determines the question type based on the data provided

_determineType(\Webenq_Model_Question $callingObject, string $language) : \Webenq_Model_Question

Parameters

$callingObject

\Webenq_Model_Question

The calling object

$language

string

Returns

\Webenq_Model_QuestionAn instance of Webenq_Model_Question

 Properties

 

$children : array
 

$_answerValues : array

Used for quickly storing answer values, i.e. by the factory method. Storing all answers as Webenq_Model_Answer objects would cause unnecessary overhead.

 

$_invalidTypes : array
 

$_questionnaire 
 

$_validTypes : array