Fix empty collections being treated as EntityContext.

An empty collection should not fall into the EntityContext as it will
cause errors downstream. Instead of just sniffing against Travserable,
using a temporary Collection to access the first element will give
a better test of what is in an object/array.

Fixes #4698
Merge pull request #4721 from cakephp/issue-4698

Fix empty collections being treated as EntityContext.