remove files older than x days
Posted in linux, memotoself on March 23rd, 2010 by paul – Be the first to commentfind .* -mtime +14 -exec rm {} \;
find .* -mtime +14 -exec rm {} \;
I wanted to use the preInsert() method to do some calculations on a model class before it was saved. But I encountered the error:
Strict Standards: Declaration of Blah::preInsert() should be compatible with that of Doctrine_Record::preInsert() in /PATH/lib/model/doctrine/Klass.class.php on line 14
The code I had in my class file looked something like this:
public function preInsert(Doctrine_Event $event)
{
$this->calculate_status();
}
This seemed correct, but I was getting this strict error.
Anyway, short story shorter, I removed the Doctrine_Event (type hint?) from my method signature and the warning went away.
New code looks like this:
public function preInsert($event)
{
$this->calculate_status();
}
I’ve started using the Symfony PHP framework for my php projects, and while the learning curve has been steeper than I would have liked, I’m getting there.
Anyway, one of the problems I’ve had a few times over the current project is the error
“couldn’t get last insert identifier”
So far, the problem has been down to the object I have been trying to create didn’t have it’s id field set to autoincrement. Or perhaps more accurately, setting that model’s id field to autoincrement has sorted the problem so far.
Hopefully once I get the hang of the schema file and the (what appears to be) the slightly different syntax for migrations, all my models should have autoincrement id fields and this shouldn’t be a problem anymore.