title: Drupal \Drupal\user\Entity\User how retrieve property
body: <p>i come from ES6 and need to do something in one Drupal 8 site.
  Basically I try to get some value from the current logged user object.</p>
  <p>...i try any possible method but nothing good.</p>
  <p>by this snippet of code i can dump($userx) variable, i need to parse</p>
  <pre><code>$userCurrent = \Drupal::currentUser();
  $uid = $userCurrent-&gt;id();
  $userx = \Drupal::entityTypeManager()-&gt;getStorage('user')-&gt;loadByProperties([
  'uid' =&gt; '13465'
  ]);
  dump($userx);
  outpup see picture
  
  
  $cf = $userx-&gt;get('field_codice_fiscale_user')-&gt;getvalue()[0]['value'];
  dump($cf);
  otput NULL
       
  </code></pre>
  <p>Results output
  <a href="https://i.stack.imgur.com/z3ZBL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z3ZBL.png" alt="enter image description here" /></a></p>
  <p>i need the value of</p>
  <pre><code>protected values
  
   field_cv_codice_fiscale
      
      x-default =&gt; array (1)
  
        0 =&gt; array (1)
  
          value =&gt; string (16) &quot;DSSSLV83D67B35QV&quot;
  </code></pre>
  <p>i tried:</p>
  <pre><code>  $cf = $userx-&gt;get('field_codice_fiscale_user')-&gt;getvalue()[0]['value'];
    again NULL
  </code></pre>
  <p>my goal is to have variable valorized by :</p>
  <pre><code>  'field_codice_fiscale_user' -&gt; value;
  </code></pre>
  <p>after struglling two days i need to give up to drupal folly.</p>
  <p>Thank you in advance</p>