src/Formatter.php
private function createEmbed(EmbeddedPropMetadata $embeddedPropMeta, Embed $embed)
    {
        $embedMeta = $embeddedPropMeta->embedMeta;

        $obj = [];
        foreach ($embedMeta->getAttributes() as $key => $attrMeta) {
            $value = $this->getAttributeDbValue($attrMeta, $embed->get($key));
            if (null === $value) {
                continue;
            }
            $obj[$key] = $value;
        }
        foreach ($embedMeta->getEmbeds() as $key => $propMeta) {
            $value = (true === $propMeta->isOne()) ? $this->getEmbedOneDbValue($propMeta, $embed->get($key)) : $this->getEmbedManyDbValue($propMeta, $embed->get($key));
            if (null === $value) {
                continue;
            }
            $obj[$key] = $value;
        }
        return $obj;
    }
private function createEmbed(EmbeddedPropMetadata $embeddedPropMeta, Embed $embed)
    {
        $embedMeta = $embeddedPropMeta->embedMeta;

        $obj = [];
        foreach ($embedMeta->getAttributes() as $key => $attrMeta) {
            $value = $this->getAttributeDbValue($attrMeta, $embed->get($key));
            if (null === $value) {
                continue;
            }
            $obj[$key] = $value;
        }
        foreach ($embedMeta->getEmbeds() as $key => $propMeta) {
            $value = (true === $propMeta->isOne()) ? $this->getEmbedOneDbValue($propMeta, $embed->get($key)) : $this->getEmbedManyDbValue($propMeta, $embed->get($key));
            if (null === $value) {
                continue;
            }
            $obj[$key] = $value;
        }
        return $obj;
    }
private function createEmbed ( EmbeddedPropMetadata $ embeddedPropMeta , Embed $ embed ) { $ embedMeta = $ embeddedPropMeta -> embedMeta ; $ obj = [ ] ; foreach ( $ embedMeta -> getAttributes ( ) as $ key => $ attrMeta ) { $ value = $ this -> getAttributeDbValue ( $ attrMeta , $ embed -> get ( $ key ) ) ; if ( null === $ value ) { continue ; } $ obj [ $ key ] = $ value ; } foreach ( $ embedMeta -> getEmbeds ( ) as $ key => $ propMeta ) { $ value = ( true === $ propMeta -> isOne ( ) ) ? $ this -> getEmbedOneDbValue ( $ propMeta , $ embed -> get ( $ key ) ) : $ this -> getEmbedManyDbValue ( $ propMeta , $ embed -> get ( $ key ) ) ; if ( null === $ value ) { continue ; } $ obj [ $ key ] = $ value ; } return $ obj ; }
Creates an embed for storage of an embed model in the database

@param   EmbeddedPropMetadata    $embeddedPropMeta
@param   Embed                   $embed
@return  array|null
Creates an embed for storage of an embed model in the database