Anahkiasen / underscore-php

A redacted PHP port of Underscore.js with additional functions and goodies – Available for Composer and Laravel
http://anahkiasen.github.com/underscore-php/
1.12k stars 88 forks source link

Fix CollectionMethods::get from objects with magic __get methods #19

Closed velosipedist closed 9 years ago

velosipedist commented 10 years ago

Problem raise with Yii ActiveRecord and other __get()-powered class collections, where property_exists() will fail.

Also i have idea to use getter-method as a key (or any method without required params) to pluck like

class Foo{ 
  function someField(){ /* returns something */ }
}

Arrays::from(/* list of Foo instances */)->pluck('someField');
Anahkiasen commented 10 years ago

Can you rebase against the latest master, the tests folder has been cleaned up slightly, I see a lot of changes related to that.

velosipedist commented 10 years ago

ok, but later in 1-2 days