public function shareObject($config = array())
    {
        $config = new AnConfig($config);

        if (!$config->object) {
            throw new InvalidArgumentException('Not object specified to share');
        }

        $config->append(array(
             'sharer' => get_viewer(),
        ));

        if ($config->object->isOwnable()) {
            $config->append(array(
                'target' => $config->object->owner,
            ));
        }

        $request = new ComSharesSharerRequest($config);
        $sharers = new ArrayObject();
        dispatch_plugin('connect.onGetShareAdapters', array('adapters' => $sharers, 'request' => $request));

        if ($config->sharers) {
            $sharers = array_filter((array) $sharers, function ($sharer) use ($config) {
               return in_array($sharer->getIdentifier()->name, $config['sharers']);
            });
        }

        foreach ($sharers as $sharer) {
            $sharer->shareRequest($request);
        }
    }
public function shareObject($config = array())
    {
        $config = new AnConfig($config);

        if (!$config->object) {
            throw new InvalidArgumentException('Not object specified to share');
        }

        $config->append(array(
             'sharer' => get_viewer(),
        ));

        if ($config->object->isOwnable()) {
            $config->append(array(
                'target' => $config->object->owner,
            ));
        }

        $request = new ComSharesSharerRequest($config);
        $sharers = new ArrayObject();
        dispatch_plugin('connect.onGetShareAdapters', array('adapters' => $sharers, 'request' => $request));

        if ($config->sharers) {
            $sharers = array_filter((array) $sharers, function ($sharer) use ($config) {
               return in_array($sharer->getIdentifier()->name, $config['sharers']);
            });
        }

        foreach ($sharers as $sharer) {
            $sharer->shareRequest($request);
        }
    }
public function shareObject ( $ config = array ( ) ) { $ config = new AnConfig ( $ config ) ; if ( ! $ config -> object ) { throw new InvalidArgumentException ( 'Not object specified to share' ) ; } $ config -> append ( array ( 'sharer' => get_viewer ( ) , ) ) ; if ( $ config -> object -> isOwnable ( ) ) { $ config -> append ( array ( 'target' => $ config -> object -> owner , ) ) ; } $ request = new ComSharesSharerRequest ( $ config ) ; $ sharers = new ArrayObject ( ) ; dispatch_plugin ( 'connect.onGetShareAdapters' , array ( 'adapters' => $ sharers , 'request' => $ request ) ) ; if ( $ config -> sharers ) { $ sharers = array_filter ( ( array ) $ sharers , function ( $ sharer ) use ( $ config ) { return in_array ( $ sharer -> getIdentifier ( ) -> name , $ config [ 'sharers' ] ) ; } ) ; } foreach ( $ sharers as $ sharer ) { $ sharer -> shareRequest ( $ request ) ; } }
Share an object using share adapters.

@param AnConfig $config An array options.
mixed object
ComActorsDomainEntityActor $subject
ComActorsDomainEntityActor $target
Share an object using share adapters .