self::TABLE, 'primary' => self::CUSTOMER_ID, 'fields' => array( self::CUSTOMER_ID => array('type' => self::TYPE_INT), self::ALIAS => array('type' => self::TYPE_STRING), self::LAST_ORDER_ID => array('type' => self::TYPE_INT), ), ); /** * Creates new entity or returns existing one with cleared alias * * @param int $customerId * * @return Przelewy24BlikAlias */ public static function prepareEmptyModel($customerId) { $model = new Przelewy24BlikAlias($customerId); $model->customer_id = $customerId; $model->alias = null; if (!Validate::isLoadedObject($model)) { $model->save(); } return $model; } }