14 Jul 08 _ Sluggable Behavior + RC2

By casey
in CakePHP, Casey's Corner
Ahh, yes. The shared pain/annoyance of upgrading Cake from RC1 to RC2 and finding that the SQL operator syntax has changed. Sure it’s more sequre, sure it’s not as elegant looking, and sure there seems to be zero backward compatibility, but yeah, it happens. It’s still a pre-release. We deal.
So for those that currently use iano Iglesias’ super-helpful Sluggable Behavior, make sure to change line 121 from:
$conditions = array($Model->alias . '.' . $this->__settings[$Model->alias]['slug'] =>' LIKE ' . $slug . '%');
to:
$conditions = array($Model->alias . '.' . $this->__settings[$Model->alias]['slug'] . ' LIKE '=> $slug . '%');
The current version, 1.1.36, does not include this fix for Cake RC2. Without this, you’ll start getting duplicate slug values, lacking any numerical appending action.









February 6th, 2009 at 5:48 am
Cake has changed the way complex queries are written so now it goes from line 121 :
$conditions = array($Model->alias . ‘.’ . ’slug LIKE’ => $slug . ‘%’);
if (!empty($Model->id))
{
$conditions[$Model->alias . '.' . $Model->primaryKey. ' '] = $Model->id;
}
if you want to maintain unique slugs
April 30th, 2009 at 10:13 pm
Does anyone know if there is another language or set of commands beside SQL for talking with databases?
I’m working on a project and am doing some research thanks
July 10th, 2009 at 9:53 am
Wow… great … thank you for this I was trying to find out where the problem was…
Saved me a lot of time !