문제

UPDATE:

It appears the slug doesn't save when using saveAll(). I have it doing a save() immediately after the saveAll, and it works now, but it's an obvious kludge, and I'd rather get it working with saveAll if possible... I have other models that should be generating slugs, and I'd rather not have to dual save every time just to create a slug.


ORIGINAL QUESTION:

Trying to implement this behavior: https://github.com/vduglued/CakePHP-Sluggable-Behavior/blob/master/sluggable.php

It was working fine, but recently it stopped... I'm not sure what the issue is, or what we changed, but I've narrowed down the problem.

In the behavior's beforeValidate(); function, it adds the correct slug to the data. When I debug $model->data at that point, it shows:

Array('Article' => array('slug'=>'test_1234')  ...

among other data.

If I remove THAT debug and debug $this->data in the beforeSave() of my Article model, it shows all the data, but NOT the slug field that should have been added via the SluggableBehavior.

I don't think I should have to alter the behavior, as I thought it was working fine before..but maybe a recent update in CakePHP versions changed something with how Behaviors and Models communicate?

도움이 되었습니까?

해결책

This was a bug in saveAssociated(), update your cake core

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top