I am overriding the standard AR delete method so that instead of using deleteByPk() it will use a new function:
public function retireByPk($pk,$condition='',$params=array())
{
Yii::trace(get_class($this).'.retireByPk()','system.db.ar.CActiveRecord');
$builder=$this->getCommandBuilder();
$criteria=$builder->createPkCriteria($this->getTableSchema(),$pk,$condition,$params);
$command=$builder->createRetireCommand($this->getTableSchema(),$criteria);
return $command->execute();
}
Every table in the DB has a column called state. When something is ‘deleted’ its state changes to 2. Thats what the retireByPk function will achieve.
I need to create a new method createRetireCommand in an extension of CDbCommandBuilder however am not sure how to extend this class - what new files do I need & where in my project do I have to reference it?