doctrine / doctrine/common

DCOM-282: Use call_user_func_array in proxy classes

Open
#594 2 comments 0 reactions 1 assignee Claimed by @beberlei View on GitHub
Improvement
Dominant language
PHP
Stars
5.8k
Forks
284
PR merge metrics
No merged PRs in 30d

Description

Jira issue originally created by user jacksleight:

At the moment the proxy generator creates methods like this:

```
public function type()
{

$this->*_initializer__ && $this->__initializer__->_*invoke($this, 'type', array());

return parent::type();
}
```

However, this breaks methods in the entity class that rely on `func*num_args` or `func_get*args` (eg. a method that can have variable arguments), as only the defined arguments are passed through to the parent method.

I would like to suggest changing the proxy generator to output code like this:

```
public function type()
{

$this->*_initializer__ && $this->__initializer__->_*invoke($this, 'type', array());

$args = func*get*args();
return call*user_func*array('parent::type', $args);
}
```

So that all arguments are passed through.

I'd be happy to create a pull request for this, unless there's a reason why you wouldn't want to do it that way?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.