Closed chasepeeler closed 8 years ago
Can I have the js file? Cheers
@pbyrne84 This happens also for masked methods:
namespace Namespace1 {
class Controller {
public function model($name) {
$name = '\Namespace1\Model\\' . $name
return new $name;
}
}
}
namespace Namespace1\Model {
class Model1 {
public function insideModel1() {
}
}
}
namespace Namespace2 {
class Controller {
public function model($name) {
$name = '\Namespace2\Model\\' . $name;
return new $name;
}
}
}
namespace Namespace2\Model {
class Model1 {
public $model2;
public function insideModel2() {
}
}
}
namespace Namespace2 {
$controllerOne = new \Namespace1\Controller();
$controllerOne->model('Model1')->insideModel1();
$controllerTwo = new \Namespace2\Controller();
// this references the first model instead of the second:
$controllerTwo->model('Model1')->
}
with config:
{
"methodCalls" : [
{
"class" : "\\Namespace1\\Controller",
"method" : "model",
"position": 0,
"mask" : "\\Namespace1\\Model\\%s"
},
{
"class" : "\\Namespace2\\Controller",
"method" : "model",
"position": 0,
"mask" : "\\Namespace2\\Model\\%s"
},
],
"functionCalls": []
}
Many thanks for the example. I have started looking into it.
On 27 February 2016 at 22:43, David Meybohm notifications@github.com wrote:
@pbyrne84 https://github.com/pbyrne84 This happens also for masked methods:
namespace Namespace1 { class Controller { public function model($name) { $name = '\Namespace1\Model\' . $name return new $name; } }}namespace Namespace1\Model { class Model1 { public function insideModel1() { } }}namespace Namespace2 { class Controller { public function model($name) { $name = '\Namespace2\Model\' . $name; return new $name; } }}namespace Namespace2\Model { class Model1 { public $model2; public function insideModel2() { } }}namespace Namespace2 { $controllerOne = new \Namespace1\Controller(); $controllerOne->model('Model1')->insideModel1(); $controllerTwo = new \Namespace2\Controller(); // this references the first model instead of the second: $controllerTwo->model('Model1')->}
with config:
{ "methodCalls" : [ { "class" : "\Namespace1\Controller", "method" : "model", "position": 0, "mask" : "\Namespace1\Model\%s" }, { "class" : "\Namespace2\Controller", "method" : "model", "position": 0, "mask" : "\Namespace2\Model\%s" }, ], "functionCalls": [] }
— Reply to this email directly or view it on GitHub https://github.com/pbyrne84/DynamicReturnTypePlugin/issues/43#issuecomment-189742232 .
In theory the deployable here https://github.com/pbyrne84/DynamicReturnTypePlugin/raw/master/deploy/DynamicReturnTypePlugin.zip fixes the problem
locate your current DynamicReturnTypePlugin folder under plugins dir, delete and replace with the unzipped contents of this one and let me know if it works.
It works. Thanks.
Thanks for the confirmation
Given the following:
Calls to both \ESP\Container::get and \ESP\Model\Factory::get are processed by the replaceModelFactory method. However, if I switch the order in which the two items appear, so that the one for \ESP\Container is first, then calls to both methods are processed by replaceContainerGet.