M
M
mills2020-06-22 16:59:53
1C-Bitrix
mills, 2020-06-22 16:59:53

How to remove return parameters from a function?

Hello!
I want to pull the parameters from the API from the function.
Connected the module:
use Bitrix\Main\Loader;
Loader::includeModule("aelita.test");

Here is the function:

public function GetQuestioning($ProfileID,&$Test)
    {
        //echo "<pre>";print_r($Test);echo "</pre>";
      $ProfileID=(int)$ProfileID;
      $TestID=(int)$Test["ID"];
      $Result=array();
      $Select=array(
         "ID",
         "PROFILE_ID",
         "TEST_ID",
         "RESULT_ID",
         "CLOSED",
         "FINAL",
         "DATE_START",
         "DATE_STOP",
         "DURATION",
         "AVER_DURATION",
         "GLASSES_ID",
         "TEST_TYPE_RESULT",
         "STEP_MULTIPLE",
     );
      if($ProfileID>0 && $TestID>0)
      {
         $el=new AelitaTestQuestioning();
         $arFields=array(
            "CLOSED"=>"N",
            "TEST_ID"=>$TestID,
            "PROFILE_ID"=>$ProfileID,
        );

         $res = $el->GetList(array("ID"=>"DESC"),$arFields,false,array("nPageSize"=>1),$Select);
         if($arr=$res->GetNext())
         {
            $Result=$arr;
            $arFields["<>ID"]=$arr["ID"];
            $res = $el->GetList(array("ID"=>"DESC"),$arFields);
            $arUpdate=array("CLOSED"=>"Y");
            while($arr=$res->GetNext())
            {
               $el->Update($arr["ID"],$arUpdate);
           }
       }
   }
   return $Result;
}


I’m trying to output it in another file, but even it doesn’t work out, I understand that I’m doing something, but I can’t figure it out.
$test = AelitaTestTools::GetQuestioning($ProfileID, $Test);
?>
<pre>
     <?print_r($test)?>
</pre>
<?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valera Karmanov, 2020-06-22
@motokraft

You only have one place where something can be written to a variable, all other cases will be an empty array,
$Result=$arr;
but what should be returned?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question