I just put it as a second argument to the setter:
Supposing that you have an Entity so a solution ti the following:
//Namespace Declaration above
class SomeEntity
{
....
private $somefield;
public function setSomefield($somefield,LoggerService $l)
{
$this->somefield=$someField;
$l->log(""Somefield Has Been Set"");
}
}
Note: Instead of LoggerService
replace it with the logger class you may have developed and call the appropriate methods the LoggerService
is an assumptio I make in order to show the way.
In case you are using Monolog and not some custom LoggingClass:
//Namespace Declaration above
use Symfony\Bridge\Monolog\Logger;
class SomeEntity
{
....
private $somefield;
public function setSomefield($somefield,Logger $l)
{
$this->somefield=$someField;
$l->info("Somefield Has Been Set");
}
}
I hope it fits your needs. This will help you better to Log the setters without probs with serialization.