title: yii2 - yii2 queue - save to db and log not working within curl job
body: <p>I am using <a href="https://github.com/yiisoft/yii2-queue" rel="nofollow noreferrer">https://github.com/yiisoft/yii2-queue</a></p>
  <p>I have function in execute method in queue class like:</p>
  <pre><code>$this-&gt;RegisterDomains($available,$registrar-&gt;end_point, $this-&gt;request_id,$model-&gt;user_id,$registrar-&gt;api_key);
  </code></pre>
  <p>and the registerDomains function looks like this:</p>
  <pre><code>public function RegisterDomains($available,$end_point,$request_id,$user_id,$api_key)
      {
          
          $model = CatchDomains::find()-&gt;where(['request_id'=&gt;$request_id])-&gt;one();
          $PathToLog = 'runtime/domaincatch';
       
         if(!(is_array($available['domain']))){         
           $domain_list = $available[&quot;domain&quot;];
           $url = $end_point.&quot;registerDomain?version=1&amp;type=xml&amp;key=$api_key&amp;domain=$domain_list&amp;years=1&quot;;
          
           $ch = curl_init();
               
               $LogFileHandle1 = fopen($PathToLog.&quot;/register.log&quot;, &quot;a+&quot;);
               curl_setopt($ch, CURLOPT_URL, $url);
               curl_setopt($ch, CURLOPT_VERBOSE, true);
               curl_setopt($ch, CURLOPT_POST, true); 
               curl_setopt( $ch,CURLOPT_RETURNTRANSFER,true); 
               curl_setopt($ch, CURLOPT_STDERR, $LogFileHandle1);
               $result = curl_exec($ch);
               $xml = simplexml_load_string($result, &quot;SimpleXMLElement&quot;, LIBXML_NOCDATA);
               $json = json_encode($xml);
               $response = json_decode($json,TRUE);
               $model-&gt;result=$result;
               $model-&gt;response = $json;
               $model-&gt;save();               
               curl_close($ch);
               echo $result;
          }
  </code></pre>
  <p>when I am executing yii queue/run from console.
  The function is executing fine &amp; no error is shown there. but nothing is saved in database for my <code>model-&gt;save()</code> or nothing is written in <code>register.log</code>
  but if I am running the function without queue both this works fine.</p>