Skip to content

Can't use function name in Presenter which is equal to the name of the property #38

Open
@pixelpeter

Description

@pixelpeter

It seems like something has changed with Laravel 5.

Currently I'm not able to use a function name which is equal to the name of the property.
So this is not working and I can't figure it out why

public function description()
{
    return $this->description;
}

This will throw an Undefined property: App\Presenter\ApplicationPresenter::$description

The only way I could get this to work is by using a different method name

public function getDescription()
{
    return $this->description;
}

or referencing the property like this

public function description()
{
    return $this->entity->description;
}

Am I doing something wrong or is this a bug in interaction with Laravel 5 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions