/**
  * creates a collection from an array of objects
  * all objects should be of the same type
  *
  * @throws InvalidArgumentException if first entry is not SimpleOrMap
  * @param array $data array with SimpleORMap objects
  * @param bool $strict check every element for correct type and unique pk
  * @return SimpleORMapCollection
  */
 public static function createFromArray(array $data, $strict = true)
 {
     $ret = new SimpleORMapCollection();
     if (count($data)) {
         $first = current($data);
         if ($first instanceof SimpleORMap) {
             $ret->setClassName(get_class($first));
             if ($strict) {
                 foreach ($data as $one) {
                     $ret[] = $one;
                 }
             } else {
                 $ret->exchangeArray($data);
             }
         } else {
             throw new InvalidArgumentException('This collection only accepts objects derived from SimpleORMap', self::WRONG_OBJECT_TYPE);
         }
     }
     return $ret;
 }