title: Using cakePHP's Hash class to extract data from an array
body: <p>I have an array like this:</p>
  
  <pre><code>Array(
      [Rating] =&gt; Array(
          [0] =&gt; Array(
              [id] =&gt; 4
              [rating] =&gt; -1
          ),
          [1] =&gt; Array(
              [id] =&gt; 14
              [rating] =&gt; 9.7
          ),
          [2] =&gt; Array(
              [id] =&gt; 26
              [rating] =&gt; 9.55
          )
      )
  )
  </code></pre>
  
  <p>I need to extract all the ratings >= 0 from this array, and JUST the numbers.  I was doing this fine with <code>Set::extract('/Rating/rating[rating&gt;-1]', $video)</code></p>
  
  <p>But I then learned that this is deprecated and you are supposed to use the Hash class now.  So I looked up the new syntax and wrote:</p>
  
  <pre><code>Hash::extract($video, 'Rating.{n}.rating[rating&gt;-1]');
  </code></pre>
  
  <p>which gives me the correct result, but it gives an annoying warning: <code>Warning (4096): Argument 1 passed to Hash::_matches() must be an array, string given, called in E:\www\lib\Cake\Utility\Hash.php on line 131 and defined [CORE\Cake\Utility\Hash.php, line 170]</code></p>
  
  <p>The warning doesn't occur when I don't have the condition in there (the <code>[rating&gt;-1]</code>) but of course includes the -1's, which I don't want.  What am I doing wrong here?  Am I misusing this function somehow?  Should I just use the deprecated Set class?  Or should I just ignore the warning because it won't show up once I put this app into production mode?</p>