..............
*\Entity\Category
*
* @ORM\Table(name="category")
* @ORM\Entity
*/
class Category implements TimestampableInterface
/**
* Caption
*
* @var string $caption
* @ORM\Column(name="caption", type="text", nullable=true)
*/
protected $caption;
/**
* Added At
*
* @var \DateTime $addedAt
*
* @ORM\Column(name="added_at", type="datetime", nullable=true)
*/
protected $addedAt;
public function setCaption($caption)
{
if ($this->caption != $caption) {
$this->_onPropertyChanged('caption', $this->caption, $caption);
$this->caption = $caption;
}
}
public function setAddedAt($addedAt)
{
$oldValue = $this->addedAt;
$this->addedAt = $addedAt;
if ((is_null($oldValue) || ($oldValue->getTimestamp() != $this->addedAt->getTimestamp()))) {
$this->_onPropertyChanged('addedAt', $oldValue, $this->addedAt);
}
}
protected function _onPropertyChanged($propName, $oldValue, $newValue)
{
if ($this->_listeners) {
/** @var $listener \Doctrine\Common\PropertyChangedListener */
foreach ($this->_listeners as $listener) {
$listener->propertyChanged($this, $propName, $oldValue, $newValue);
}
}
}
public function addPropertyChangedListener(PropertyChangedListener $listener)
{
$this->_listeners[] = $listener;
}
..............
This is intentional to me.
According to code and documentation, PropertyChanged is supposed to operate over updates, never over inserts.
I experimented changing the code to also notify about changed during new and the consequences were very drastic. Internally, propertyChanged creates entityChangesets that implies an UPDATE.
Marking ticket as won't fix.