add changes to create ticket

This commit is contained in:
2015-10-08 10:13:29 +02:00
parent 2e906de8c2
commit c3ae414bba
21 changed files with 650 additions and 45 deletions

View File

@@ -3,6 +3,7 @@
namespace common\models;
use Yii;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "ticket_type".
@@ -193,5 +194,42 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
}
}
}
/**
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
* */
public static function read($forceIncludeObjectWithId = null){
$ticketTypes = null;
if ( $forceIncludeObjectWithId == null){
$ticketTypes = TicketType::find()->andWhere(['status' => self::STATUS_ACTIVE])->all();
}else{
$ticketTypes = TicketType::find()->andWhere( ['or', ['status' => self::STATUS_ACTIVE], ['id_ticket_type' => $forceIncludeObjectWithId ] ])->all();
}
return $ticketTypes;
}
public static function modelsToArray($models,$default = []){
if ( $models == null ){
return $default;
}
return ArrayHelper::toArray($models, [
'common\models\TicketType' => [
'name',
'id_ticket_type',
'max_usage_count',
'time_unit_type',
'time_unit_count',
'id_account',
'price_brutto',
],
]);
}
}