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 ($realplexorObject);
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.