Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDC-4019: Proxy generator is not including PHP7 return type hints #4884

Closed
doctrinebot opened this issue Nov 25, 2015 · 7 comments
Closed

DDC-4019: Proxy generator is not including PHP7 return type hints #4884

doctrinebot opened this issue Nov 25, 2015 · 7 comments
Assignees
Labels
Milestone

Comments

@doctrinebot
Copy link

Jira issue originally created by user radmen:

Proxy generator skips return type hints which results in generating non-compatible proxies.

Entity example:

<?php

namespace Domain\Members;

use Doctrine\ORM\Mapping as ORM;

/****
 * @ORM\Entity
 */
class Member
{

    /****
     * @ORM\Id()
     * @ORM\Column(type="guid")
     * @var string
     */
    private $id;

    public function getId(): string
    {
        return $this->id;
    }
}

Generated proxy:

<?php

namespace DoctrineProxies\*_CG_*\Domain\Members;

/****
 * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR
 */
class Member extends \Domain\Members\Member implements \Doctrine\ORM\Proxy\Proxy
{

    // CUT

    /****
     * {@inheritDoc}
     */
    public function getId()
    {

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

        return parent::getId();
    }

}

Currently only workaround for this is to remove return type hints definitions.

@thomask
Copy link

thomask commented Dec 22, 2015

Didn't properly investigate, but I think the same might go for scalar type hints (doctrine/orm v2.4.8)

@Majkl578
Copy link
Contributor

I think this is fixed by https://github.com/doctrine/common/pull/376/files, but it's unfortunately only in 2.6.0 which can't be installed with docrine/orm=2.5.*.

@BenMorel
Copy link
Contributor

This is a major issue, that affects scalar type hints as well indeed. In its current state, the ORM just cannot work with entities using scalar type hints or return types.

What prevents doctrine/common 2.6.0 from being used with doctrine/orm 2.5.* exactly?

@Ocramius
Copy link
Member

Time, and the lack of it.
On Dec 24, 2015 4:32 AM, "Benjamin Morel" notifications@github.com wrote:

This is a major issue, that affects scalar type hints as well indeed. In
its current state, the ORM just cannot work with entities using scalar type
hints or return types.

What prevents doctrine/common 2.6.0 from being used with doctrine/orm
2.5.* exactly?


Reply to this email directly or view it on GitHub
#4884 (comment)
.

@BenMorel
Copy link
Contributor

I mean, is it just a matter of updating the composer.json file?

If I force using 2.6.0 ("doctrine/common": "2.6.0 as 2.5.3"), it seems to work fine.

I can open a PR on the ORM and DBAL packages to modify their composer.json, but I'm not sure if there is another problem as you guys could do this modification in 2 clicks?

@Ocramius
Copy link
Member

Yup, just a matter of doing that and preparing a new release ;-)
On Dec 24, 2015 12:13, "Benjamin Morel" notifications@github.com wrote:

I mean, is it just a matter of updating the composer.json file?

If I force using 2.6.0 ("doctrine/common": "2.6.0 as 2.5.3"), it seems to
work fine.

I can open a PR on the ORM and DBAL packages to modify their composer.json,
but I'm not sure if there is another problem as you guys could do this
modification in 2 clicks?


Reply to this email directly or view it on GitHub
#4884 (comment)
.

@Ocramius Ocramius added this to the 2.5.3 milestone Dec 25, 2015
@Ocramius Ocramius assigned Ocramius and unassigned guilhermeblanco Dec 25, 2015
Ocramius added a commit that referenced this issue Dec 25, 2015
Ocramius added a commit that referenced this issue Dec 25, 2015
@BenMorel
Copy link
Contributor

Thanks @Ocramius 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants