fitness-web/frontend/models/CustomerUpdate.php

98 lines
2.4 KiB
PHP

<?php
namespace frontend\models;
use Yii;
use common\models\Customer;
/**
* This is the model class for table "customer".
*
* @property integer $id_customer
* @property integer $id_customer_card
* @property integer $id_user
* @property integer $id_partner_card
* @property integer $id_proposer
* @property string $name
* @property string $email
* @property string $password
* @property string $phone
* @property integer $sex
* @property string $date_stundent_card_expire
* @property string $birthdate
* @property string $image
* @property string $description
* @property string $tax_number
* @property string $country
* @property string $zip
* @property string $city
* @property string $address
* @property string $created_at
* @property string $updated_at
* @property string $cardNumber
*/
class CustomerUpdate extends \common\models\Customer
{
public $cardNumber;
public $partnerCardNumber;
public $password_plain;
public $password_repeat;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'customer';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
// [['cardNumber'], 'required' ],
// [['cardNumber'], 'string', 'max' => 10],
// [['cardNumber'], 'validateCustomerCard' ],
[['partnerCardNumber'], 'string', 'max' => 10],
[['partnerCardNumber'], 'validatePartnerCard' ],
[['name'], 'required' ],
[['name'], 'string', 'max' => 128],
[['email'], 'string', 'max' => 255],
[['email'], 'email' ],
[['email'], 'unique' ],
[['password_plain','password_repeat'], 'string', 'max' => 32],
[['sex'], 'integer'],
[[ 'birthdate', ], 'date' ],
[[ 'date_stundent_card_expire', ], 'date' ],
[[ 'description', 'address'], 'string', 'max' => 255],
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
[['zip'], 'string', 'max' => 8],
[['city'], 'string', 'max' => 30]
];
}
public function validateCustomerCard($a,$p){
// Customer::find()->andWhere( [$this->cardNumber )
}
public function validatePartnerCard($a,$p){
// Customer::find()->andWhere( [$this->cardNumber )
}
}