module/FzyCommon/src/FzyCommon/Entity/Base.php
public function flatCollection($collection, $extended = false, $indexById = false)
    {
        $results = array();
        foreach ($collection as $entity) {
            if (!$entity instanceof BaseInterface) {
                $results[] = $entity;
                continue;
            }
            $value = $extended ? $entity->flatten() : $entity->id();
            if ($indexById) {
                $results[$entity->id()] = $value;
            } else {
                $results[] = $value;
            }
        }

        return $results;
    }
public function flatCollection($collection, $extended = false, $indexById = false)
    {
        $results = array();
        foreach ($collection as $entity) {
            if (!$entity instanceof BaseInterface) {
                $results[] = $entity;
                continue;
            }
            $value = $extended ? $entity->flatten() : $entity->id();
            if ($indexById) {
                $results[$entity->id()] = $value;
            } else {
                $results[] = $value;
            }
        }

        return $results;
    }
Calls flatten on each of the entities in a collection. If $indexById is true
the returned array is a key/value associative array with the entity ids as the key
@param $collection
@param  bool  $extended
@param  bool  $indexById
@return array