Factory/MyChannelFactory.php
public function createEntity(array $data, $myChannel = false)
    {
        if (false === $myChannel) {
            $myChannel = MyChannel::create();
        }

        $myChannel = (new ChannelFactory())->createEntity($data, $myChannel);

        if (isset($data['email'])) {
            $myChannel = $myChannel->setEmail($data['email']);
        }

        if (isset($data['stream_key'])) {
            $myChannel = $myChannel->setStreamKey($data['stream_key']);
        }

        return $myChannel;
    }
public function createEntity(array $data, $myChannel = false)
    {
        if (false === $myChannel) {
            $myChannel = MyChannel::create();
        }

        $myChannel = (new ChannelFactory())->createEntity($data, $myChannel);

        if (isset($data['email'])) {
            $myChannel = $myChannel->setEmail($data['email']);
        }

        if (isset($data['stream_key'])) {
            $myChannel = $myChannel->setStreamKey($data['stream_key']);
        }

        return $myChannel;
    }
@param array $data
@param false|MyChannel $myChannel

@return MyChannel