src/components/Synchronizer.php
public function syncActiveRecord( $serviceName = null, ActiveRecord $model ) {

        $service = $this->getService( $serviceName );

        if ( $service->isConnected() && ! $this->isExistsSyncModelByActiveRecord( $service, $model ) ) {

            $message  = $model->{$this->modelAttribute};
            $function = $this->absolutePostUrl;

            $url = null;
            if ( is_callable( $function ) && ( $function instanceof Closure ) ) {
                $url = $function( $serviceName, $model->getPrimaryKey() );
            }

            $publishData = $service->publishPost( $message, $url );

            return $this->checkPostData( $publishData ) && $this->createSyncModel( $service, $model, $publishData );

        } else {
            return false;
        }
    }
public function syncActiveRecord( $serviceName = null, ActiveRecord $model ) {

        $service = $this->getService( $serviceName );

        if ( $service->isConnected() && ! $this->isExistsSyncModelByActiveRecord( $service, $model ) ) {

            $message  = $model->{$this->modelAttribute};
            $function = $this->absolutePostUrl;

            $url = null;
            if ( is_callable( $function ) && ( $function instanceof Closure ) ) {
                $url = $function( $serviceName, $model->getPrimaryKey() );
            }

            $publishData = $service->publishPost( $message, $url );

            return $this->checkPostData( $publishData ) && $this->createSyncModel( $service, $model, $publishData );

        } else {
            return false;
        }
    }
public function syncActiveRecord ( $ serviceName = null , ActiveRecord $ model ) { $ service = $ this -> getService ( $ serviceName ) ; if ( $ service -> isConnected ( ) && ! $ this -> isExistsSyncModelByActiveRecord ( $ service , $ model ) ) { $ message = $ model -> { $ this -> modelAttribute } ; $ function = $ this -> absolutePostUrl ; $ url = null ; if ( is_callable ( $ function ) && ( $ function instanceof Closure ) ) { $ url = $ function ( $ serviceName , $ model -> getPrimaryKey ( ) ) ; } $ publishData = $ service -> publishPost ( $ message , $ url ) ; return $ this -> checkPostData ( $ publishData ) && $ this -> createSyncModel ( $ service , $ model , $ publishData ) ; } else { return false ; } }
Post message with URL to Social Network

@param null $serviceName
@param \yii\db\ActiveRecord $model

@return bool
Post message with URL to Social Network