# |
Jun 15th 2018, 09:26 |
tunafish |
fair enough ;) |
# |
Jun 15th 2018, 09:26 |
josbeir |
@tunafish thats why there are tests :slightly_smiling_face: |
# |
Jun 15th 2018, 09:25 |
cakephp924 |
I have Chartkinds as belongsTo |
# |
Jun 15th 2018, 09:25 |
cakephp924 |
im my model Chart |
# |
Jun 15th 2018, 09:24 |
cakephp924 |
in that line |
# |
Jun 15th 2018, 09:24 |
cakephp924 |
I got Error: Call to a member function find() on null |
# |
Jun 15th 2018, 09:24 |
cakephp924 |
$chartkinds = $this->Chart->Chartkinds->find('list'); |
# |
Jun 15th 2018, 09:24 |
cakephp924 |
hi I have a 'strange' problem with cake 2.x |
# |
Jun 15th 2018, 09:11 |
tunafish |
Sure, I'm just not sure what other consequences it might have |
# |
Jun 15th 2018, 09:10 |
josbeir |
can you create a ticket? Or even better, a PR ? :slightly_smiling_face: |
# |
Jun 15th 2018, 09:09 |
josbeir |
seems like an issue indeed |
# |
Jun 15th 2018, 09:09 |
tunafish |
Same validator for a modelles form and an entity |
# |
Jun 15th 2018, 09:09 |
tunafish |
When I change array_merge to array_replace, the keys are preserved |
# |
Jun 15th 2018, 09:09 |
josbeir |
to be clear, you are using a nestedMany validator on a modelless form ? |
# |
Jun 15th 2018, 09:08 |
tunafish |
It's the entity validation which is messing stuff up |
# |
Jun 15th 2018, 09:08 |
tunafish |
No, since the form actually does produce the correct output |
# |
Jun 15th 2018, 09:08 |
josbeir |
Bit late @tunafish but isnt i think the problem is in the FormContext:error method ? |
# |
Jun 15th 2018, 08:36 |
josbeir |
morning ! |
# |
Jun 15th 2018, 08:07 |
neon1024 |
Morning all |
# |
Jun 15th 2018, 07:47 |
tunafish |
When the form is validated the keys are preserverd (since $entity->setErrors() is not called), but when validating entities the indexes are gone |
# |
Jun 15th 2018, 07:47 |
tunafish |
Some context: I'm using a Validator which is used by an entity, and by a modelless form |
# |
Jun 15th 2018, 07:40 |
tunafish |
So, when validating an array of 3 records and the second has some errors, the output claims the error is on the first record |
# |
Jun 15th 2018, 07:39 |
tunafish |
It appears that EntityInterface::setErrors adds the errors with array_merge, which means all numeric indexes are gone |
# |
Jun 15th 2018, 07:38 |
tunafish |
Hi guys, has anybody here had some issues with nested validators losing their indexes in the actual error output? |
# |
Jun 15th 2018, 05:40 |
narendravaghela |
by the way, good morning all |
# |
Jun 15th 2018, 05:39 |
narendravaghela |
@cpierce You should put it in your model as a function where you are making a database query and call that function from your controller action to get the formatted data back. |
# |
Jun 15th 2018, 01:51 |
cpierce |
ok so a little more in depth for my question ... i have my recusive loop written now and needed to put it in a function - where should i put it ... assuming in the model but which file and how do i call it? |
# |
Jun 15th 2018, 01:15 |
ricksaccous |
no problem |
# |
Jun 15th 2018, 01:15 |
cpierce |
thanks @ricksaccous |
# |
Jun 15th 2018, 01:15 |
cpierce |
yep that works |
# |
Jun 15th 2018, 01:13 |
ricksaccous |
https://book.cakephp.org/3.0/en/core-libraries/collections.html |
# |
Jun 15th 2018, 01:13 |
cpierce |
perhaps... let me look |
# |
Jun 15th 2018, 01:13 |
ricksaccous |
can collections help? |
# |
Jun 15th 2018, 01:13 |
cpierce |
is there a better way? |
# |
Jun 15th 2018, 01:12 |
cpierce |
best way i can figure is to pull them indivudally |
# |
Jun 15th 2018, 01:12 |
cpierce |
i need to loop through some data pulled form a database and then just keep looping and getting the rows under it ... |
# |
Jun 15th 2018, 01:12 |
cpierce |
what would be the proper place to put a recursive function in cakephp3.6? |
# |
Jun 14th 2018, 22:46 |
rightscoreanalysis |
if i debug $mainArticle in the view I see count 1 |
# |
Jun 14th 2018, 22:45 |
rightscoreanalysis |
in my view I am trying $mainArticle->id which doesn't work |
# |
Jun 14th 2018, 22:44 |
rightscoreanalysis |
$mainArticle = $articles->take(1); |
# |
Jun 14th 2018, 22:44 |
rightscoreanalysis |
If for example I use this in my controller: |