Has created the resource plugin to work with the class Realplexor, using it to exchange messages between multiple clients, it is well suited for a chat. Prescribed for this plugin settings application.ini. The controller for the test write the following code:
$realplexorObject = Zend_Registry::get('realplexor');
print_r ($realpl开发者_C百科exorObject);
die ();
He gives the following:
Dklab_Realplexor Object
(
    [_timeout:Dklab_Realplexor:private] => 5
    [_host:Dklab_Realplexor:private] => rpl.newchat.com
    [_port:Dklab_Realplexor:private] => 10010
    [_identifier:Dklab_Realplexor:private] => identifier
    [_login:Dklab_Realplexor:private] => 
    [_password:Dklab_Realplexor:private] => 
    [_namespace] => Chat_
)
ie Dklab_Realplexor object is created and stored in Zend_Registry, but that would work with him I want to write for him a model with specific methods for my project that should use class methods Dklab_Realplexor, how exactly does this do?
I tried to write a model like this:
class Application_Model_Realplexor_Message extends Dklab_Realplexor
{
    public function  __construct() {
        return Zend_Registry::get('realplexor');
    }
    public function post ($text, $fromUser = 0, $fromOperator = 0) {
        $this->send("Alpha", $text);
    }
}
But, if you create an object of this model in the controller, it is why it is not initialized:
$realplexorMessageModel = new Application_Model_Realplexor_Message(); print_R ($realplexorMessageModel); die ();
issues:
Application_Model_Realplexor_Message Object
(
    [_timeout:Dklab_Realplexor:private] => 5
    [_host:Dklab_Realplexor:private] => 
    [_port:Dklab_Realplexor:private] => 
    [_identifier:Dklab_Realplexor:private] => 
    [_login:Dklab_Realplexor:private] => 
    [_password:Dklab_Realplexor:private] => 
)
I would like to make this plug-in resource and model for him on the same principle as a model made for existing ZF plug-in resources for the database.
Maybe you can try this:
class Application_Model_Realplexor_Message
{
    protected $realplexor;
    public function  __construct() {
        $this->realplexor = Zend_Registry::get('realplexor');
    }
    public function post ($text, $fromUser = 0, $fromOperator = 0) {
        $this->realplexor->send("Alpha", $text);
    }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论