Use an array filter : if (count(array_filter($data, function ($entry) { return !($entry instanceof CriterioDigital); })) > 0) { throw new ... ... <看更多>
First, there is the ArrayObject class which is pretty close to what you have with a normal array (you can iterate it, use [] etc.) If you use it as a parent for ... ... <看更多>
Twig doesn't have a native "instanceof" check, but it'd be pretty trivial to create a simple plugin that added a Twig Extension where you ... ... <看更多>
First, convert an array of duplicates to a Set . The new Set will implicitly remove duplicate elements. Then, convert the set back to an array. ... <看更多>