src/Entity.php
public function toArray($nesting = false)
    {
        $output = [];
        foreach ($this::getReflection()->getProperties() as $propertyName => $property) {

            $value = $this->{$propertyName};
            if (($value instanceof Entity\Collection || $value instanceof Entity)
                && $nesting
            ) {
                $output[$propertyName] = $value->toArray($nesting);
            } else {
                $output[$propertyName] = $value;
            }
        }

        return $output;
    }
public function toArray($nesting = false)
    {
        $output = [];
        foreach ($this::getReflection()->getProperties() as $propertyName => $property) {

            $value = $this->{$propertyName};
            if (($value instanceof Entity\Collection || $value instanceof Entity)
                && $nesting
            ) {
                $output[$propertyName] = $value->toArray($nesting);
            } else {
                $output[$propertyName] = $value;
            }
        }

        return $output;
    }
public function toArray ( $ nesting = false ) { $ output = [ ] ; foreach ( $ this :: getReflection ( ) -> getProperties ( ) as $ propertyName => $ property ) { $ value = $ this -> { $ propertyName } ; if ( ( $ value instanceof Entity \ Collection || $ value instanceof Entity ) && $ nesting ) { $ output [ $ propertyName ] = $ value -> toArray ( $ nesting ) ; } else { $ output [ $ propertyName ] = $ value ; } } return $ output ; }
Get entity values as array

@param boolean $nesting Convert nested entities and collections too

@return array
Get entity values as array