title: Getting error: Class name must be a valid object or a string
body: <p>So I've got an issue with element-api in php, which is a plugin for CRAFT cms, could someone help - what am I doing wrong here? I can't print time.json - always getting :</p>
  <blockquote>
  <p>{&quot;error&quot;:{&quot;code&quot;:0,&quot;message&quot;:&quot;Class name must be a valid object or a
  string&quot;}}</p>
  </blockquote>
  <p>here's the code:</p>
  <pre><code>&lt;?php
  
  use Craft;
  use craft\elements\Entry;
  use craft\controllers\TemplatesController;
  use League\Fractal\TransformerAbstract;
  use craft\web\View;
  use craft\elements\User;
  
  return [
      'endpoints' =&gt; [
      'tooltip-modal.json' =&gt; function() {
              
          $affiliateId = Craft::$app-&gt;request-&gt;getParam('entryId');
          $siteLanguage = Craft::$app-&gt;request-&gt;getParam('siteLanguage');
  
          $data = [
              'elementType' =&gt; Entry::class,
              'paginate' =&gt; false,
              'transformer' =&gt; function(Entry $affiliate) {
                  $view = Craft::$app-&gt;getView();
                  // $view-&gt;setTemplateMode($view::TEMPLATE_MODE_SITE);
                  return [
                      'affiliate' =&gt; $view-&gt;renderTemplate('modals/tooltipAffModal.twig', ['affiliate' =&gt; $affiliate])
  
                  ];
              },
              'criteria' =&gt; ['id' =&gt; $affiliateId, 'site' =&gt; $siteLanguage]
          ];
          
          return $data;
      },
      'time.json' =&gt; function() {
          // $userId = Craft::$app-&gt;request-&gt;request-&gt;getParam('userId');
  
          $data = [
              'elementType' =&gt; User::class,
              'paginate' =&gt; false,
              'transformer' =&gt; function(User $user) {
                  return [
                      'date' =&gt; $user-&gt;winHistory::find()-&gt;orderBy(['id' =&gt; SORT_DESC])-&gt;one()
                      
  
                  ];
              },
              // 'criteria' =&gt; ['id' =&gt; $affiliateId, 'site' =&gt; $siteLanguage]
  
          ];
          return $data;
      }
      ]
  ];
  </code></pre>