Skip to content

[PropertyAccess] Custom methods on property accesses #6400

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

Closed
wants to merge 1 commit into from

Conversation

lrlopez
Copy link

@lrlopez lrlopez commented Mar 26, 2016

Q A
Doc fix? no
New docs? symfony/symfony#22190
Applies to Property access
Fixed tickets None

@lrlopez
Copy link
Author

lrlopez commented Mar 28, 2016

Guys, just a quick question. I was expecting a plataformsh automatic documentation deploy of this PR but found none. Has the feature been discontinued or am I just doing something wrong?

@xabbuh
Copy link
Member

xabbuh commented Mar 30, 2016

This seems to be a general issue with Platform.sh. @GuGuss can you help us here (this seems to affect all recent pull requests)?

<Symfony\\Component\\PropertyAccess\\PropertyAccessorBuilder::setMetadataFactory>`
see `Enable other Features`_.

There are four method calls that can be overriden: `getter`, `setter`, `adder` and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor syntax issue: in Markdown you can use this:

`getter`, `setter`, `adder` and `remover`

but in RST you must use double backticks:

``getter``, ``setter``, ``adder`` and ``remover``

@javiereguiluz
Copy link
Member

@lrlopez this is truly a useful feature. I hope it's included in Symfony soon! Thank you also for providing the docs for the feature.

@lrlopez
Copy link
Author

lrlopez commented Apr 10, 2016

@javiereguiluz Thank you very much for the review!

@lrlopez lrlopez force-pushed the property_access_docs branch 3 times, most recently from ba1c468 to 3aa2e31 Compare April 12, 2016 20:06
@lrlopez
Copy link
Author

lrlopez commented Apr 12, 2016

All comments have been addressed

@lrlopez lrlopez force-pushed the property_access_docs branch 2 times, most recently from 7375b21 to cd683e7 Compare April 13, 2016 21:09
@xabbuh xabbuh added this to the 3.2 milestone May 21, 2016
@lrlopez lrlopez force-pushed the property_access_docs branch from cd683e7 to 88622d5 Compare July 3, 2016 15:41
@lrlopez
Copy link
Author

lrlopez commented Jul 3, 2016

Docs ready for final review!

@lrlopez lrlopez force-pushed the property_access_docs branch from 88622d5 to 8b788ba Compare July 3, 2016 16:21
@GuGuss
Copy link

GuGuss commented Jul 11, 2016

@lrlopez @xabbuh I'm not sure why we face long delays sometimes between automated PR deployments. The PR has now been deployed without me doing anything :)

@lrlopez lrlopez force-pushed the property_access_docs branch from 8b788ba to 17a6fdd Compare April 9, 2017 22:03
@lrlopez
Copy link
Author

lrlopez commented Apr 9, 2017

Docs have been rebased to latest master so no conflicts arise anymore. By the way, related PR are now symfony/symfony#22190 and symfony/symfony#22191

Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for documenting this awesome feature :)

Custom method calls and virtual properties in a class
-----------------------------------------------------

Sometimes you may not want the component to guess which method has to be called
Copy link
Contributor

@HeahDude HeahDude Apr 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a .. versionadded:: directive.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I target 3.3 or 3.4? I think is 3.4, but I'd like to be sure

.. code-block:: php-annotations

// ...
use Symfony\Component\PropertyAccess\Annotation\Property;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does make sense to name the annotation class PropertyAccess but maybe it is worth an alias, wdyt?

Copy link
Author

@lrlopez lrlopez Apr 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I've been thinking all the day around about renaming the annotation class to Accessor. Do you think is better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but it would not be that consistent with the other, so what about:

/**
 * @PropertyAcessor(...)
 */
private $property;

/**
 * @GetterAccessor(...)
 */
public function propertyState()
{
    // ...
}

/**
 * @SetterAccessor(...)
 */
public function updateProperty()
{
    // ...
}

/**
 * @AdderAccessor(...)
 */
public function increaseProperty(Arg $arg)
{
    // ...
}

/**
 * @RemoverAccessor(...)
 */
public function decreaseProperty(Arg $arg)
{
    // ...
}

WDYT?

Copy link
Author

@lrlopez lrlopez Apr 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's do this way then! We can change later them if we don't like the results...

// Notice that there is no real "total" property

/**
* @PropertyGetter(property="total")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HeahDude, we could rename this annotation to just Getter and do the same to the others (Setter, Adder and Remover). Do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems I've answered above at the same time :). I don't know what's best though.

@weaverryan weaverryan changed the title [PropertyAccess] Custom methods on property accesses [WCM][PropertyAccess] Custom methods on property accesses Oct 6, 2017
@weaverryan weaverryan added the Waiting Code Merge Docs for features pending to be merged label Oct 6, 2017
@lrlopez lrlopez force-pushed the property_access_docs branch from f4d4ff2 to 1abbb44 Compare October 8, 2017 09:36
@lrlopez lrlopez force-pushed the property_access_docs branch from 1abbb44 to 5f4e4b6 Compare October 8, 2017 09:40
@lrlopez
Copy link
Author

lrlopez commented Oct 8, 2017

Although it may not be needed, I've squashed the commits.

@xabbuh xabbuh modified the milestones: 3.3, 4.1 Jan 29, 2018
@xabbuh xabbuh changed the base branch from master to 4.1 May 8, 2018 08:43
@xabbuh xabbuh changed the base branch from 4.1 to master May 8, 2018 08:44
@xabbuh xabbuh modified the milestones: 4.1, next May 8, 2018
@javiereguiluz javiereguiluz changed the title [WCM][PropertyAccess] Custom methods on property accesses [PropertyAccess] Custom methods on property accesses Jun 1, 2018
@OskarStark
Copy link
Contributor

Code PR closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PropertyAccess Waiting Code Merge Docs for features pending to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants