src/CoreBundle/EventListener/DcGeneral/Table/Attribute/AttributeSavedListener.php
public function handle(PostPersistModelEvent $event)
    {
        if (!$this->wantToHandle($event)) {
            return;
        }

        $old         = $event->getOriginalModel();
        $new         = $event->getModel();
        $oldInstance = $old->getProperty('pid') ? $this->createAttributeInstance($old) : null;
        $newInstance = $this->createAttributeInstance($new);

        // If type or column name has been changed, destroy old data and initialize new.
        if ($this->isAttributeNameOrTypeChanged($new, $old)) {
            // Destroy old instance.
            if ($oldInstance) {
                $oldInstance->destroyAUX();
            }

            // Create new instance aux info.
            if ($newInstance) {
                $newInstance->initializeAUX();
            }
        }

        if ($newInstance) {
            // Now loop over all values and update the meta in the instance.
            foreach ($new->getPropertiesAsArray() as $strKey => $varValue) {
                $newInstance->handleMetaChange($strKey, $varValue);
            }
        }
    }
public function handle(PostPersistModelEvent $event)
    {
        if (!$this->wantToHandle($event)) {
            return;
        }

        $old         = $event->getOriginalModel();
        $new         = $event->getModel();
        $oldInstance = $old->getProperty('pid') ? $this->createAttributeInstance($old) : null;
        $newInstance = $this->createAttributeInstance($new);

        // If type or column name has been changed, destroy old data and initialize new.
        if ($this->isAttributeNameOrTypeChanged($new, $old)) {
            // Destroy old instance.
            if ($oldInstance) {
                $oldInstance->destroyAUX();
            }

            // Create new instance aux info.
            if ($newInstance) {
                $newInstance->initializeAUX();
            }
        }

        if ($newInstance) {
            // Now loop over all values and update the meta in the instance.
            foreach ($new->getPropertiesAsArray() as $strKey => $varValue) {
                $newInstance->handleMetaChange($strKey, $varValue);
            }
        }
    }
Handle the update of an attribute and all attached data.

@param PostPersistModelEvent $event The event.

@return void