# |
Mar 12th 2018, 12:36 |
pedroseco |
On mobile atm, just wanted to have a ideia what would be the best practice on this case |
# |
Mar 12th 2018, 12:33 |
joddit |
Maybe paste something on gist so we can take a look |
# |
Mar 12th 2018, 12:31 |
pedroseco |
I calculated a value during mapping and I also want to filter my results by that value |
# |
Mar 12th 2018, 12:30 |
pedroseco |
yes that is correct |
# |
Mar 12th 2018, 12:25 |
joddit |
I guess I'd have to see how you were using it |
# |
Mar 12th 2018, 12:24 |
joddit |
So you want to take a value that you calculated during the mapping process and use it in a where clause? O_o |
# |
Mar 12th 2018, 12:22 |
pedroseco |
I mean, I already use where() to filter data before, I just need to filter it again by the value I create after. |
# |
Mar 12th 2018, 12:22 |
pedroseco |
in this case yes, since I want to filter data from a dynamic field I create on formatResults() |
# |
Mar 12th 2018, 12:20 |
joddit |
The where clause is inappropriate to add earlier? |
# |
Mar 12th 2018, 12:17 |
pedroseco |
How can i search using ->where() on a query where i manipulated the results by using map/reduce with formatResults() ? |
# |
Mar 12th 2018, 12:17 |
Martin` |
hi |
# |
Mar 12th 2018, 12:17 |
joddit |
Hi |
# |
Mar 12th 2018, 12:17 |
pedroseco |
Hi guys. |
# |
Mar 12th 2018, 12:00 |
dereuromark |
Its actually https://github.com/cakephp/migrations/issues/333 |
# |
Mar 12th 2018, 11:49 |
neon1024 |
@dereuromark I think I might have been thinking of this issue, which is pretty old, https://github.com/cakephp/migrations/pull/321 |
# |
Mar 12th 2018, 11:49 |
joddit |
I'm sure there's a better way than forcing a rule to pass |
# |
Mar 12th 2018, 11:48 |
joddit |
Yeah, what situation is making you do this? What are you trying to accomplish? |
# |
Mar 12th 2018, 11:48 |
neon1024 |
Or even just normalize the optional parts out |
# |
Mar 12th 2018, 11:48 |
neon1024 |
Or change the process of creating the data to be incremental |
# |
Mar 12th 2018, 11:47 |
neon1024 |
If you want to sidestep one, perahps you should consider refactoring your associations |
# |
Mar 12th 2018, 11:47 |
neon1024 |
The rules are there to ensure your foreign key validity and stuff like that |
# |
Mar 12th 2018, 11:47 |
birdy247 |
_rules is protected |
# |
Mar 12th 2018, 11:47 |
neon1024 |
Sure, you can see the edge of the cliff, but you wouldn’t run off it without a good reason |
# |
Mar 12th 2018, 11:47 |
birdy247 |
its all about adding |
# |
Mar 12th 2018, 11:46 |
birdy247 |
I have had a look at the rules checker |
# |
Mar 12th 2018, 11:46 |
birdy247 |
@neon1024 I can see how to remove it though |
# |
Mar 12th 2018, 11:46 |
neon1024 |
@dereuromark I believe there is a ticket open for that |
# |
Mar 12th 2018, 11:46 |
joddit |
But you want to force pass a rule no? |
# |
Mar 12th 2018, 11:46 |
neon1024 |
Although I rules are for data integrity, so if you want to remove one, I’d stop and think why |
# |
Mar 12th 2018, 11:45 |
dereuromark |
Is anyone planning to make migrations upgrade to phinx 0.9.*? That would be super awesome |
# |
Mar 12th 2018, 11:45 |
neon1024 |
As marshalling is for validating request data |
# |
Mar 12th 2018, 11:45 |
joddit |
I think you can whitelist it? |
# |
Mar 12th 2018, 11:45 |
neon1024 |
You’ll want to modify it in beforeSave |
# |
Mar 12th 2018, 11:45 |
birdy247 |
How can I remove the rule from there? |
# |
Mar 12th 2018, 11:44 |
joddit |
Use beforemarshal |
# |
Mar 12th 2018, 11:44 |
joddit |
https://book.cakephp.org/3.0/en/orm/saving-data.html#modifying-request-data-before-building-entities |
# |
Mar 12th 2018, 11:43 |
birdy247 |
Is it possible to remove a specific rule before a saveOperation? |
# |
Mar 12th 2018, 11:42 |
dorxy |
in case you're interested in my issue: https://github.com/cakephp/migrations/issues/353 |
# |
Mar 12th 2018, 11:28 |
neon1024 |
Good idea :slightly_smiling_face: |
# |
Mar 12th 2018, 11:28 |
dorxy |
but perhaps it's best to create an issue on github for this, since I believe it might be a bug |
# |
Mar 12th 2018, 11:28 |
neon1024 |
Probably best to just ask an open question to the community I would think then |