瀏覽代碼

Suppression attribut 'class' inutile dans la méthode "defaultOptionsSearch"

dev
Guillaume Bourgeois 6 年之前
父節點
當前提交
a88d04f14b
共有 6 個檔案被更改,包括 14 行新增9 行删除
  1. +12
    -5
      common/components/ActiveRecordCommon.php
  2. +0
    -1
      common/models/CreditHistory.php
  3. +0
    -1
      common/models/Invoice.php
  4. +0
    -1
      common/models/Order.php
  5. +2
    -0
      common/models/PointSale.php
  6. +0
    -1
      common/models/Subscription.php

+ 12
- 5
common/components/ActiveRecordCommon.php 查看文件

@@ -40,9 +40,9 @@ namespace common\components ;

class ActiveRecordCommon extends \yii\db\ActiveRecord
{
const SEARCH_ALL = 'all' ;
const SEARCH_ONE = 'one' ;
const SEARCH_COUNT = 'count' ;
const SEARCH_ALL = 'all' ;
const SEARCH_ONE = 'one' ;
const SEARCH_COUNT = 'count' ;
/**
* Méthode générique de recherche utilisée pour tous les modèles. Elle a
@@ -57,7 +57,14 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord
{
$class = get_called_class() ;
$default_options = $class::defaultOptionsSearch() ;
if(is_callable([$class, 'defaultOptionsSearch'])) {
$default_options = $class::defaultOptionsSearch() ;
}
else {
throw new \ErrorException('La méthode "defaultOptionsSearch" n\'est '
. 'pas définie dans la classe "'.$class.'"');
}
$options = array_merge($default_options, $options) ;
$pk = $class::primaryKey() ;
@@ -71,7 +78,7 @@ class ActiveRecordCommon extends \yii\db\ActiveRecord
$options['type_search'] = self::SEARCH_ALL ;
}
$records = $options['class']::find() ;
$records = $class::find() ;
// With
if(is_array($options['with']) && count($options['with'])) {

+ 0
- 1
common/models/CreditHistory.php 查看文件

@@ -139,7 +139,6 @@ class CreditHistory extends ActiveRecord
*/
public static function defaultOptionsSearch() {
return [
'class' => 'CreditHistory',
'with' => [],
'join_with' => [],
'orderby' => self::tableName().'.date ASc',

+ 0
- 1
common/models/Invoice.php 查看文件

@@ -116,7 +116,6 @@ class Invoice extends \yii\db\ActiveRecord
public static function defaultOptionsSearch()
{
return [
'class' => 'Invoice',
'with' => [],
'join_with' => [],
'orderby' => self::tableName().'.date ASc',

+ 0
- 1
common/models/Order.php 查看文件

@@ -152,7 +152,6 @@ class Order extends ActiveRecordCommon
*/
public static function defaultOptionsSearch() {
return [
'class' => 'Order',
'with' => ['productOrder', 'creditHistory', 'pointSale'],
'join_with' => ['production', 'user', 'user.userProducer'],
'orderby' => 'order.date ASC',

+ 2
- 0
common/models/PointSale.php 查看文件

@@ -141,6 +141,8 @@ class PointSale extends \yii\db\ActiveRecord
);
}

/**
* Initialise les commandes liées au point de vente.
*

+ 0
- 1
common/models/Subscription.php 查看文件

@@ -153,7 +153,6 @@ class Subscription extends ActiveRecordCommon
*/
public static function defaultOptionsSearch() {
return [
'class' => 'Subscription',
'with' => ['producer', 'pointSale', 'productSubscription'],
'join_with' => ['user'],
'orderby' => 'user.name ASC',

Loading…
取消
儲存