Skip to content

Instantly share code, notes, and snippets.

@phalcon phalcon/a.php
Last active Dec 18, 2015

Embed
What would you like to do?
<?php
class Data
{
protected $service;
public function setMyService($service)
{
$this->service = $service;
}
}
class myService
{
}
$di = new Phalcon\DI();
$di->set('myservice', function() {
return $myservice = new myService();
});
$di->set('Data', array(
'className' => 'Data',
'calls' => array(
array(
'method' => 'setMyservice',
'arguments' => array(
array('type' => 'service', 'name' => 'myservice'),
)
),
)
));
$data = $di->get('Data');
var_dump($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.