处理网络相关
@return void
549904
private function parseNetwork()
    {
        // 用户名密码认证处理
        $username = $this->request->getAttribute('username');
        if(null != $username)
        {
            $auth = base64_encode($username . ':' . $this->request->getAttribute('password', ''));
            $this->request = $this->request->withAddedHeader('Authorization', 'Basic ' . $auth);
        }
        // 超时
        $this->settings['timeout'] = $this->request->getAttribute('timeout', 30000) / 1000;
    }
1292869
public function index() {
        $wt_tree = Globals::getTree();
        Theme::theme(new AdministrationTheme)->init($wt_tree);
        $controller = new PageController();
        $controller
            ->restrictAccess(Auth::isManager($wt_tree))
            ->setPageTitle($this->module->getTitle());
        
        $data = new ViewBag();
        $data->set('title', $controller->getPageTitle());
        $data->set('tree', $wt_tree);
        
        $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig');
                
        $table_id = 'table-geoanalysis-' . Uuid::uuid4();
        $data->set('table_id', $table_id);
        
        $other_trees = array();
        foreach (Tree::getAll() as $tree) {
            if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
        }      
        $data->set('other_trees', $other_trees);
        
        $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
        
        $controller
            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
            ->addInlineJavascript('
				jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
				jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
                
				var geoAnalysisTable = jQuery("#'.$table_id.'")
                .on("draw.dt", function ( e, settings, json, xhr ) {
                    jQuery("[data-toggle=\'tooltip\']").tooltip();
                }).DataTable({
					'.I18N::datatablesI18N().',			
					sorting: [[3, "asc"], [4, "asc"]],
					pageLength: 10,
                    processing: true,
                    serverSide : true,
					ajax : {
						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='. $wt_tree->getNameUrl().'",
                        type : "POST"
					},
                    columns: [
						/* 0 Edit		 	*/ { sortable: false, className: "text-center"},
                        /* 1 ID             */ { sortable: false, visible: false},
						/* 2 Enabled 		*/ { sortable: false, className: "text-center"  },
						/* 3 Description	*/ { type: "text" },
						/* 4 Analysis Level	*/ { type: "text", dataSort: 5, className: "text-center" },
						/* 5 ANAL_LEVEL_SORT*/ { type: "num", visible: false },
						/* 6 Map 	        */ { type: "text", sortable: false, className: "text-center" },
						/* 7 Map Top Level 	*/ { type: "text", sortable: false, className: "text-center" },
						/* 8 Use Flags     	*/ { type: "text", sortable: false, className: "text-center" },					
						/* 9 Place Details	*/ { type: "text", sortable: false, className: "text-center" }
					],
				});
                
                ')
                ->addInlineJavascript('				
                    function set_geoanalysis_status(ga_id, status, gedcom) {
                		jQuery.ajax({
                            url: "module.php", 
                            type: "GET",
                            data: {
                			    mod: "' . $this->module->getName() .'",
                                mod_action:  "GeoAnalysis@setStatus",
                			    ga_id: ga_id,
                			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom,
                                status: status
                            },
                            error: function(result, stat, error) {
                                var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
                                alert("' . I18N::translate('An error occured while editing this analysis:') . '" + err);
                            },
                            complete: function(result, stat) {
                                geoAnalysisTable.ajax.reload(null, false);
                            }                            
                		});
                    }
                    
                    function delete_geoanalysis(ga_id, status, gedcom) {
                		jQuery.ajax({
                            url: "module.php", 
                            type: "GET",
                            data: {
                			    mod: "' . $this->module->getName() .'",
                                mod_action:  "GeoAnalysis@delete",
                			    ga_id: ga_id,
                			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom
                            },
                            error: function(result, stat, error) {
                                var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
                                alert("' . I18N::translate('An error occured while deleting this analysis:') . '" + err);
                            },
                            complete: function(result, stat) {
                                geoAnalysisTable.ajax.reload(null, false);
                            }                            
                		});
                    }
                ');
        
        
        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
    }
1044692
public function register()
    {
        $this->mergeConfigFrom(__DIR__ . '/config/lxu-alipay.php', 'lxu-alipay');
        //PC支付对象绑定
        $this->app->bind('PcAlipay', function () {

            $pcAlipay = new PcSdk();
            $pcAlipay->partner       = config('lxu-alipay.pcconfig.partner');
            $pcAlipay->cacert        = __DIR__.'\\config\\cacert.pem';
            $pcAlipay->key           = config('lxu-alipay.pcconfig.key');
            $pcAlipay->sign_type     = config('lxu-alipay.pcconfig.sign_type');
            $pcAlipay->input_charset = config('lxu-alipay.pcconfig.input_charset');
            $pcAlipay->transport     = config('lxu-alipay.pcconfig.transport');
            return $pcAlipay;
        });
        //手机支付对象绑定
        $this->app->bind('MobileAlipay', function () {

            $mobileAlipay = new MobileSdk();
            $mobileAlipay->partner              = config('lxu-alipay.mobileconfig.partner');
            $mobileAlipay->cacert               = __DIR__.'\\config\\cacert.pem';
            $mobileAlipay->key                  = config('lxu-alipay.mobileconfig.key');
            $mobileAlipay->sign_type            = config('lxu-alipay.mobileconfig.sign_type');
            $mobileAlipay->input_charset        = config('lxu-alipay.mobileconfig.input_charset');
            $mobileAlipay->ali_public_key_path  = __DIR__.'\\config\\key\\rsa_public_key.pem';
            $mobileAlipay->private_key_path     = __DIR__.'\\config\\key\\rsa_private_key.pem';
            $mobileAlipay->transport            = config('lxu-alipay.mobileconfig.transport');
            return $mobileAlipay;
        });
    }
736202
public function index() {
        $wt_tree = Globals::getTree();
        $controller = new PageController();
        $controller
        ->setPageTitle(I18N::translate('Sosa Configuration'))
        ->restrictAccess(Auth::check())
        ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
        ->addInlineJavascript('autocomplete();')
        ->addInlineJavascript('
            $( document ).ready(function() {
                $("#bt_sosa_compute").click(function() {
                    majComputeSosa($("#maj_sosa_input_userid, #maj-sosa-config-select option:selected").val());
                 });
            });
            
            function majComputeSosa(user_id) {
                jQuery("#bt_sosa_compute").prop( "disabled", true );
                jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i>&nbsp;'. I18N::translate('Computing...') .'");
                jQuery("#bt_sosa_computing").load(
		          "module.php?mod='.$this->module->getName().'&mod_action=SosaConfig@computeAll&ged='.$wt_tree->getNameUrl().'&userid=" + user_id,
		          function() {
			         jQuery("#bt_sosa_compute").prop( "disabled", false );
                  });
            }');
        
        $action = Filter::post('action');
        if($action === 'update') $this->update($controller);
        
        $view_bag = new ViewBag();
        $view_bag->set('title', $controller->getPageTitle());
        $view_bag->set('tree', $wt_tree);
        $view_bag->set('form_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaConfig&ged='.$wt_tree->getNameUrl());
        
        $users_root = array();
        $users_js_array = 'var users_array = [];';
        if(Auth::check()) {
            $root_id = $wt_tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
            $users_root[] = array( 'user' => Auth::user(), 'rootid' => $root_id);
            $users_js_array .=  'users_array["'.Auth::user()->getUserId().'"] = "' . $root_id . '";';
            
            if(Auth::isManager($wt_tree)) {
                $default_user = User::find(-1);
                $default_root_id = $wt_tree->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID');
                $users_root[] = array( 'user' => $default_user, 'rootid' => $default_root_id);
                $users_js_array .=  'users_array["'.$default_user->getUserId().'"] = "' . $default_root_id . '";';
            }
        }
        $view_bag->set('users_settings', $users_root);       
        
        $controller->addInlineJavascript($users_js_array . '            
                $("#maj-sosa-config-select").change(function() {
                    $("#rootid").val(users_array[this.value]);
                });
             ');
        
        ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render();   
    }
810287
protected function init()
    {
        parent::init();

        $this->driver = Queue::DRIVER_SHM;

        if ($this->id <= 0) {
            // 定义共享内存,信号量key
            $this->id = PhpHelper::ftok(__FILE__, $this->options['project']);
        }

        // create queues
        $this->queues = new \SplFixedArray(count($this->getPriorities()));
    }
918006
public function handle()
    {
        /** @var Request $request */
        $request =& $this->flow->contexts['request'];

        // 如果当前请求是初始请求，那么对其进行额外处理
        // 如果当前请求是CLI，那么直接当做为初始化请求
        if (PHP_SAPI == 'cli' || $request->isInitial())
        {
            if (
                ( ! empty($_SERVER['HTTPS']) && filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
                || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'])
                && in_array($_SERVER['REMOTE_ADDR'], Request::$trustedProxies)
            )
            {
                $request->secure = true;
            }

            if (isset($_SERVER['REQUEST_METHOD']))
            {
                $method = $_SERVER['REQUEST_METHOD'];
            }
            else
            {
                $method = Http::GET;
            }

            if (isset($_SERVER['HTTP_REFERER']))
            {
                $referrer = $_SERVER['HTTP_REFERER'];
            }

            if (isset($_SERVER['HTTP_USER_AGENT']))
            {
                Request::$userAgent = $_SERVER['HTTP_USER_AGENT'];
            }

            if (isset($_SERVER['HTTP_X_REQUESTED_WITH']))
            {
                $requestedWith = $_SERVER['HTTP_X_REQUESTED_WITH'];
            }

            Request::$clientIp = Request::getClientIP();

            if ($method !== Http::GET)
            {
                $body = file_get_contents('php://input');
            }

            $cookies = [];
            if (($cookieKeys = array_keys($_COOKIE)))
            {
                foreach ($cookieKeys as $key)
                {
                    $cookies[$key] = Cookie::get($key);
                }
            }

            if (isset($_SERVER['SERVER_PROTOCOL']))
            {
                $request->protocol = $_SERVER['SERVER_PROTOCOL'];
            }

            $request
                ->query($_GET)
                ->post($_POST);

            if (isset($method))
            {
                $request->method = $method;
            }
            if (isset($referrer))
            {
                $request->referrer = $referrer;
            }
            if (isset($requestedWith))
            {
                $request->requestedWith = $requestedWith;
            }
            if (isset($body))
            {
                $request->body = $body;
            }
            if (isset($cookies))
            {
                $request->cookie($cookies);
            }
        }
    }
648419
public function run()
	{
		if(!empty($this->links)) {
		
			$links=array();
	
			foreach($this->links as $label=>$url) {
				if(is_string($label) || is_array($url))
					$links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url, array('title'=>$label));
				//else
				//	$links[] = '<span>'.($this->encodeLabel ? CHtml::encode($url) : $url).'</span>';
			}
		}
		
		/*
		if($this->homeLink===null)
			$links[]=CHtml::link(Yii::t('phrase', 'Close'), 'javascript:void(0);', array('title'=>Yii::t('phrase', 'Close'), 'class'=>'closed','off_address'=>''));
		elseif($this->homeLink!==false)
			$links[]=$this->homeLink;
		*/
		
		if(!empty($this->links)) {
			echo implode($this->separator,$links);
			echo ' '.Yii::t('phrase', 'or').' ';
		}
		echo CHtml::link(Yii::t('phrase', 'Close'), 'javascript:void(0);', array('title'=>Yii::t('phrase', 'Close'), 'class'=>'closed','off_address'=>''));
	}
949124
public function onRender()
    {

        $meta = $this->dataStore->meta();
        $showColumnKeys = array();

        if ($this->columns == array()) {
            if ($row = $this->dataStore[0]) {
                $showColumnKeys = array_keys($row);
            } else if (count($meta["columns"]) > 0) {
                $showColumnKeys = array_keys($meta["columns"]);
            }
        } else {
            foreach ($this->columns as $cKey => $cValue) {

                if ($cKey === "{others}") {
                    $allKeys = array_keys($this->dataStore[0]);
                    foreach ($allKeys as $k) {
                        if (!in_array($k, $showColumnKeys)) {
                            $meta["columns"][$k] = array_merge($meta["columns"][$k], $cValue);
                            array_push($showColumnKeys, $k);
                        }
                    }
                } else {
                    if (gettype($cValue) == "array") {
                        if ($cKey === "#") {
                            $meta["columns"][$cKey] = array(
                                "type" => "number",
                                "label" => "#",
                                "start" => 1,
                            );
                        }

                        $meta["columns"][$cKey] = array_merge($meta["columns"][$cKey], $cValue);
                        if (!in_array($cKey, $showColumnKeys)) {
                            array_push($showColumnKeys, $cKey);
                        }
                    } else {
                        if ($cValue === "#") {
                            $meta["columns"][$cValue] = array(
                                "type" => "number",
                                "label" => "#",
                                "start" => 1,
                            );
                        }
                        if (!in_array($cValue, $showColumnKeys)) {
                            array_push($showColumnKeys, $cValue);
                        }
                    }

                }
            }
        }

        $cleanColumnKeys = array();
        foreach ($showColumnKeys as $key) {
            if (!in_array($key, $this->excludedColumns)) {
                array_push($cleanColumnKeys, $key);
            }
        }
        $showColumnKeys = $cleanColumnKeys;

        if (count($this->group) === 0 && count($this->sorting)>0) {
            $this->dataStore->sort($this->sorting);
        }

        //Prepare data
        $this->template(
            "Table",
            array(
                "showColumnKeys" => $showColumnKeys,
                "meta" => $meta,
            )
        );
    }
677525
public function init(){
		$table_definition = $this->exdb->get_table_definition_all();
		// var_dump($table_definition);
		$error = array();
		foreach($table_definition->tables as $table_name=>$table_definition_row){
			// var_dump($table_definition_row);

			$sql_create_db = '';
			$sql_create_db .= 'CREATE TABLE '.$this->exdb->get_physical_table_name($table_definition_row->name).' (';
			$ary_table_columns = array();
			$ary_foreign_keys = array();
			foreach( $table_definition_row->columns as $column_definition ){
				$sql_column_definition = '';

				// セル名
				$sql_column_definition .= $column_definition->name;

				// 型
				switch(strtolower( $column_definition->type )){
					case 'email':
					case 'string':
					case 'password':
					case 'auto_id':
						$sql_column_definition .= ' VARCHAR';
						break;
					case 'create_date':
					case 'update_date':
					case 'delete_date':
						$sql_column_definition .= ' DATETIME';
						break;
					case 'int':
					case 'integer':
					case 'number':
					case 'auto_increment':
						$sql_column_definition .= ' INTEGER';
						break;
					case 'delete_flg':
						$sql_column_definition .= ' INTEGER';
						break;
					case 'text':
					case 'date':
					case 'datetime':
					default:
						$sql_column_definition .= ' '.strtoupper($column_definition->type);
						break;
				}

				// NOT NULL 制約
				if( @$column_definition->not_null ){
					$sql_column_definition .= ' NOT NULL';
				}

				// UNIQUE 制約
				if( @$column_definition->unique ){
					$sql_column_definition .= ' UNIQUE';
				}

				// FOREIGN KEY 制約
				if( @$column_definition->foreign_key ){
					$ary_foreign_keys[$column_definition->name] = $column_definition->foreign_key;
				}

				array_push($ary_table_columns, $sql_column_definition);
			}
			$sql_create_db .= implode($ary_table_columns, ',');

			if( count($ary_foreign_keys) ){
				// FOREIGN KEY 制約
				foreach($ary_foreign_keys as $colName=>$foreign_tbl_col){
					$sql_create_db .= ', FOREIGN KEY (';
					$sql_create_db .= $colName;
					$sql_create_db .= ')';
					$foreign_tbl_col = explode('.', $foreign_tbl_col);
					$sql_create_db .= ' REFERENCES '.$this->exdb->get_physical_table_name($foreign_tbl_col[0]).'('.$foreign_tbl_col[1].')';
				}
			}

			$sql_create_db .= ');';
			// var_dump($sql_create_db);
			$result = @$this->exdb->pdo()->query($sql_create_db);
			// var_dump($result);
			if( !$result ){
				array_push($error, '[ERROR] Failed to create table "'.$this->exdb->get_physical_table_name($table_definition_row->name).'"');
			}
		}
		// var_dump($error);
		$rtn = true;
		if(count($error)){$rtn = false;}
		return $rtn;
	}
291012
public function run()
	{
		list($name,$id)=$this->resolveNameID();
		if(isset($this->htmlOptions['id']))
			$id=$this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;

		$isRange=isset($this->options['range']) && $this->options['range'] &&
			$this->options['range']!=='max' && $this->options['range']!=='min';

		if($this->hasModel())
		{
			$attribute=$this->attribute;
			if($isRange)
			{
				$options=$this->htmlOptions;
				echo CHtml::activeHiddenField($this->model,$this->attribute,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::activeHiddenField($this->model,$this->maxAttribute,$options);
				$maxAttribute=$this->maxAttribute;
				$this->options['values']=array($this->model->$attribute,$this->model->$maxAttribute);
			}
			else
			{
				echo CHtml::activeHiddenField($this->model,$this->attribute,$this->htmlOptions);
				$this->options['value']=$this->model->$attribute;
			}
		}
		else
		{
			if($isRange)
			{
				list($maxName,$maxId)=$this->resolveNameID('maxName','maxAttribute');
				$options=$this->htmlOptions;
				echo CHtml::hiddenField($name,$this->value,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::hiddenField($maxName,$this->maxValue,$options);
				$this->options['values']=array($this->value,$this->maxValue);
			}
			else
			{
				echo CHtml::hiddenField($name,$this->value,$this->htmlOptions);
				if($this->value!==null)
					$this->options['value']=$this->value;
			}
		}

		$idHidden=$this->htmlOptions['id'];
		$this->htmlOptions['id']=$idHidden.'_slider';
		echo CHtml::tag($this->tagName,$this->htmlOptions,'');

		$this->options[$this->event]=$isRange
			? new CJavaScriptExpression("function(e,ui){ v=ui.values; jQuery('#{$idHidden}').val(v[0]); jQuery('#{$idHidden}{$this->maxIdSuffix}').val(v[1]); }")
			: new CJavaScriptExpression("function(event, ui) { jQuery('#{$idHidden}').val(ui.value); }");

		$options=CJavaScript::encode($this->options);
		Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}_slider').slider($options);");
	}
1101486
public function index()
    {
        $this->Search->addFilter('email');

        $this->Search->addFilter('role_id', [
            'options' => $this->Users->Roles->find('list')->toArray(),
        ]);

        $search = $this->Search->search($this->Users->find('all', ['contain' => ['Roles']]));

        $this->set('users', $this->paginate($search));

        $this->render(Configure::read('CM.AdminUserViews.index'));
    }
619344
public function index()
    {
        $this->getListingService()
            ->setOrder($this->getOrder())
            ->setPagination($this->getPagination())
            ->getFilters()->add($this->getSearchFilter());
        $this->set(
            [
                $this->getEntityNamePlural() => $this->getListingService()
                    ->getList(),
                'pagination' => $this->getListingService()->getPagination()
            ]
        );
    }
1218784
private function buildRow(): void
    {
        if ($this->model->noGutters) {
            $this->grid->addClass('no-gutters');
        }

        if ($this->model->rowClass) {
            $this->grid->addClass($this->model->rowClass);
        }

        if ($this->model->align) {
            $this->grid->align($this->model->align);
        }

        if ($this->model->justify) {
            $this->grid->justify($this->model->justify);
        }
    }
1003588
public function start()
    {
        $httpServer = $this->getHttpServer();

        // 是否正在运行
        if ($httpServer->isRunning()) {
            $serverStatus = $httpServer->getServerSetting();

            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        } else {
            $serverStatus = $httpServer->getServerSetting();
        }

        // 启动参数
        $this->setStartArgs($httpServer);
        $httpStatus = $httpServer->getHttpSetting();
        $tcpStatus = $httpServer->getTcpSetting();

        // Setting
        $workerNum = $httpServer->setting['worker_num'];

        // HTTP 启动参数
        $httpHost = $httpStatus['host'];
        $httpPort = $httpStatus['port'];
        $httpMode = $httpStatus['mode'];
        $httpType = $httpStatus['type'];

        // TCP 启动参数
        $tcpEnable = $serverStatus['tcpable'];
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpEnable = $tcpEnable ? '<info>Enabled</info>' : '<warning>Disabled</warning>';

        // 信息面板
        $lines = [
            '                         Server Information                      ',
            '********************************************************************',
            "* HTTP | host: <note>$httpHost</note>, port: <note>$httpPort</note>, type: <note>$httpType</note>, worker: <note>$workerNum</note>, mode: <note>$httpMode</note>",
            "* TCP  | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpEnable)",
            '********************************************************************',
        ];

        // 启动服务器
        \output()->writeln(implode("\n", $lines));
        $httpServer->start();
    }
429831
public function init()
    {
        /**
         * 设置默认时区
         */
        if ($this->timezone)
        {
            date_default_timezone_set($this->timezone);
        }

        /**
         * 设置地区信息（地域信息）
         */
        if ($this->locale)
        {
            setlocale(LC_ALL, $this->locale);
        }

        if ($this->charset && function_exists('mb_internal_encoding'))
        {
            mb_internal_encoding($this->charset);
        }

        /**
         * 当输入字符的编码是无效的，或者字符代码不存在于输出的字符编码中时，可以为其指定一个替代字符。
         *
         * @link http://www.php.net/manual/function.mb-substitute-character.php
         */
        mb_substitute_character('none');

        // 确保输入的数据安全
        $_GET = Security::sanitize($_GET);
        $_POST = Security::sanitize($_POST);
        $_COOKIE = Security::sanitize($_COOKIE);

        self::cleanComponents();
    }
1176506
public function index()
    {
        $conditions = [];
        $params = (array)$this->request->query();
        if (!empty($params['model'])) {
            $conditions['model'] = $params['model'];
        }
        if (!empty($params['foreign_key'])) {
            $conditions['foreign_key'] = $params['foreign_key'];
        }

        $this->paginate = [
            'conditions' => $conditions,
        ];
        $permissions = $this->paginate($this->Permissions);

        $this->set(compact('permissions'));
        $this->set('_serialize', ['permissions']);
    }
158562
public function index()
    {
        $this->request->allowMethod('get');

        $query = $this->SavedSearches->find('all')
            ->where(['name IS NOT' => null])
            ->where(['name !=' => ''])
            ->where($this->request->getQueryParams());

        $entities = $this->paginate($query);

        $this->set('success', true);
        $this->set('data', $entities);
        $this->set('_serialize', ['success', 'data']);
    }