Log message #4050561

# At Username Text
# Jul 11th 2017, 12:10 bernat the test cases is the only place I've found the fourth argument used but still no explanations.
# Jul 11th 2017, 12:09 bernat I've already checked the api and test cases
# Jul 11th 2017, 12:09 bernat Am I using the CounterCacheBehavior in the wrong way ignoring the fourth argument?
# Jul 11th 2017, 12:08 admad bernat: check api and test cases
# Jul 11th 2017, 11:57 bernat I'm looking at the CounterCacheBehavior class and I see that it uses a fourth argument when calling a custom count function. I think I have to use that fourth argument to calculate the count for the newly associated entity or the old one. I haven't found anything about this in the docs and I'm a bit confused. There's some more info or examples about how this fourth argument should be used?
# Jul 11th 2017, 11:50 hmic a pull request
# Jul 11th 2017, 11:49 miks when you said [15:40] <hmic> maybe you implement it and setup a PR? could be interesting, maybe.
# Jul 11th 2017, 11:49 miks btw, whats a PR?
# Jul 11th 2017, 11:46 miks i see... thanks
# Jul 11th 2017, 11:44 hmic if your beforesave has insight and acts upon the data in the entity, you can make it act upon the real data, not the virtual one too...
# Jul 11th 2017, 11:44 hmic as you do not save that virtual property to the database anyways, your beforeSave does not need to care...
# Jul 11th 2017, 11:44 hmic the virtual properties are dependent on the current state of the entity - you implemented it this way!
# Jul 11th 2017, 11:42 miks when i run $entity['virtual_property'] it gives me 'value1' but when i run $entity->getOriginal('virtual_property') i was expecting 'value 2' but gave me 'value 1'
# Jul 11th 2017, 11:42 hmic sure
# Jul 11th 2017, 11:41 miks then i have a virtual function which returns "value1" if property == 1 and 'value2' if property == 2
# Jul 11th 2017, 11:41 hmic sure
# Jul 11th 2017, 11:41 miks when i use $entity['property'] it gives me 1 and when i use $entity->getOriginal('property') it gives me 2
# Jul 11th 2017, 11:40 miks i made a behavior, and inside the behavior there is a beforeSave
# Jul 11th 2017, 11:40 hmic maybe you implement it and setup a PR? could be interesting, maybe.
# Jul 11th 2017, 11:40 miks i'm confused. Let me explain my situation.
# Jul 11th 2017, 11:39 hmic :p
# Jul 11th 2017, 11:39 hmic it has not been changed anyways
# Jul 11th 2017, 11:39 miks ohh thanks
# Jul 11th 2017, 11:39 hmic miks, like you said: you cannot.
# Jul 11th 2017, 11:38 miks is there a way to get the original virtual property?
# Jul 11th 2017, 11:37 mallick thanks buddy :+1:
# Jul 11th 2017, 11:37 hmic you could seperate it into a plugin, if that makes sense to you
# Jul 11th 2017, 11:36 hmic mallick: use a prefix maybe? then use crud+crudview and your backend is done.
# Jul 11th 2017, 11:36 mallick one quick question,, my project has two part,, one frontend and other is backend,, so what i do for backend??? make a plugin or what??
# Jul 11th 2017, 11:36 hmic so the answer is?
# Jul 11th 2017, 11:35 miks but when i use $entity->getOriginal('virtual_property') it just gives me $entity['virtual_property']
# Jul 11th 2017, 11:33 hmic miks, i guess you know the answer already
# Jul 11th 2017, 11:32 miks hi, i know we can access original value of entity with $entity->getOrignal('property') but how can you get an original virtual property like something similar to $entity->getOrignal('virtual_property')
# Jul 11th 2017, 11:28 hmic add it to dev dependencies, maybe, to get the tests too?
# Jul 11th 2017, 11:28 bernat Thanks, now I know it's not something broken in my app.
# Jul 11th 2017, 11:27 neon1024 Think so. Not sure how that’s been achieved though ;)
# Jul 11th 2017, 11:27 neon1024 If you checkout cakephp/cakephp into it’s own repo they should be there I think
# Jul 11th 2017, 11:27 bernat But they're in github. Are they remove only from releases?
# Jul 11th 2017, 11:27 neon1024 I think it’s because they’re not in cakephp/app
# Jul 11th 2017, 11:27 neon1024 Yeah the framework doesn’t come with tests any more
# Jul 11th 2017, 11:26 bernat I can't find cakephp/cakephp/tests/TestCase in my vendors directory.