add changes to create ticket
This commit is contained in:
@@ -22,8 +22,11 @@ use Yii;
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class Ticket extends \yii\db\ActiveRecord
|
||||
class Ticket extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
const STATUS_DELETED = 0;
|
||||
const STATUS_ACTIVE = 10;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user