When I change the datatime with Sonata, it returns the error:
DateTime::__construct() expects parameter 1 to be string, object given
This is my entity:
public function setExpiry($dateAsString = null) {
$this->expiry = new \DateTime($dateAsString);
}
Why am I getting this error?