Closed idev247 closed 11 years ago
I'm not sure how to approach this... How can I make the Sluggable's _makeUnique scope dynamic? I only know the scope once the beforeSave is called but the scope is set in the settings. Example of my scope:
beforeSave
$scope = array('StoreCollection.store_id' => $this->storeId);
Maybe I could change it so that when beforeSlug is called it also passes $this.The call would be like this:
$this
$slug = $model->beforeSlug($this, $slug);
The model would have this:
public function beforeSlug($behavior, $slug) { $behavior->settings[$this->alias]['scope'] = array('StoreCollection.store_id' => $this->storeId); return $slug; }
Would that work? Is there a better way? (sorry for the edits... github submitted the form when I hit return/enter)
I think the beforeSlug was modified? Thanks! I wasn't sure if it was a good practice to pass $this in a function. I'll try it!
Yeah its in master right now, haven't tagged yet. Let me know if that works for you.
I'm not sure how to approach this... How can I make the Sluggable's _makeUnique scope dynamic? I only know the scope once the
beforeSave
is called but the scope is set in the settings. Example of my scope:Maybe I could change it so that when beforeSlug is called it also passes
$this
.The call would be like this:The model would have this:
Would that work? Is there a better way? (sorry for the edits... github submitted the form when I hit return/enter)