Search.php 822 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. namespace fecshop\models\mysqldb;
  10. use yii\db\ActiveRecord;
  11. use yii\base\InvalidValueException;
  12. /**
  13. * @author Terry Zhao <2358269014@qq.com>
  14. * @since 1.0
  15. */
  16. class Search extends ActiveRecord
  17. {
  18. public static function tableName()
  19. {
  20. return '{{%full_search_product}}';
  21. }
  22. public function beforeSave($insert)
  23. {
  24. foreach ($this->attributes() as $attr) {
  25. if (is_array($this->{$attr})) {
  26. throw new InvalidValueException('search model save fail, attribute ['.$attr. '] is array, you must serialize it before save ');
  27. }
  28. }
  29. return parent::beforeSave($insert);
  30. }
  31. }