After insert object hook.

@param  \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface  $entity  Entity object
@param  string  $signalInfo  Signal information
@return  void
341622
public function afterInsertObject(DomainObjectInterface $entity, $signalInfo)
    {
        if ($entity instanceof $this->className) {
            if (method_exists($this, 'created')) {
                $this->created($entity);
            }

            if (method_exists($this, 'saved')) {
                $this->saved($entity);
            }
        }
    }
592061
private function removeFromEntityCollectionAndNotify(string $propName, EntityInterface $entity): void
    {
        if ($this->$propName === null) {
            $this->$propName = new ArrayCollection();
        }
        if ($this->$propName instanceof PersistentCollection) {
            $this->$propName->initialize();
        }
        if (!$this->$propName->contains($entity)) {
            return;
        }
        $oldValue = $this->$propName;
        $this->$propName->removeElement($entity);
        $newValue = $this->$propName;
        foreach ($this->notifyChangeTrackingListeners as $listener) {
            $listener->propertyChanged($this, $propName, $oldValue, $newValue);
        }
    }
795824
public function emit(Signal $signal)
    {
        if ($this->transactionDepth === 0) {
            $this->signalDispatcher->emit($signal);
        } else {
            $this->signalsQueue[$this->transactionCount][] = $signal;
        }
    }
1175276
protected function doInsert(ConnectionInterface $con)
    {
        $modifiedColumns = array();
        $index = 0;

        $this->modifiedColumns[MediaTableMap::COL_ID] = true;
        if (null !== $this->id) {
            throw new PropelException('Cannot insert a value for auto-increment primary key (' . MediaTableMap::COL_ID . ')');
        }

         // check the columns in natural order for more readable SQL queries
        if ($this->isColumnModified(MediaTableMap::COL_ID)) {
            $modifiedColumns[':p' . $index++]  = 'id';
        }
        if ($this->isColumnModified(MediaTableMap::COL_SOURCE_ID)) {
            $modifiedColumns[':p' . $index++]  = 'source_id';
        }
        if ($this->isColumnModified(MediaTableMap::COL_PAGEID)) {
            $modifiedColumns[':p' . $index++]  = 'pageid';
        }
        if ($this->isColumnModified(MediaTableMap::COL_TITLE)) {
            $modifiedColumns[':p' . $index++]  = 'title';
        }
        if ($this->isColumnModified(MediaTableMap::COL_URL)) {
            $modifiedColumns[':p' . $index++]  = 'url';
        }
        if ($this->isColumnModified(MediaTableMap::COL_MIME)) {
            $modifiedColumns[':p' . $index++]  = 'mime';
        }
        if ($this->isColumnModified(MediaTableMap::COL_WIDTH)) {
            $modifiedColumns[':p' . $index++]  = 'width';
        }
        if ($this->isColumnModified(MediaTableMap::COL_HEIGHT)) {
            $modifiedColumns[':p' . $index++]  = 'height';
        }
        if ($this->isColumnModified(MediaTableMap::COL_SIZE)) {
            $modifiedColumns[':p' . $index++]  = 'size';
        }
        if ($this->isColumnModified(MediaTableMap::COL_SHA1)) {
            $modifiedColumns[':p' . $index++]  = 'sha1';
        }
        if ($this->isColumnModified(MediaTableMap::COL_THUMBURL)) {
            $modifiedColumns[':p' . $index++]  = 'thumburl';
        }
        if ($this->isColumnModified(MediaTableMap::COL_THUMBMIME)) {
            $modifiedColumns[':p' . $index++]  = 'thumbmime';
        }
        if ($this->isColumnModified(MediaTableMap::COL_THUMBWIDTH)) {
            $modifiedColumns[':p' . $index++]  = 'thumbwidth';
        }
        if ($this->isColumnModified(MediaTableMap::COL_THUMBHEIGHT)) {
            $modifiedColumns[':p' . $index++]  = 'thumbheight';
        }
        if ($this->isColumnModified(MediaTableMap::COL_THUMBSIZE)) {
            $modifiedColumns[':p' . $index++]  = 'thumbsize';
        }
        if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURL)) {
            $modifiedColumns[':p' . $index++]  = 'descriptionurl';
        }
        if ($this->isColumnModified(MediaTableMap::COL_DESCRIPTIONURLSHORT)) {
            $modifiedColumns[':p' . $index++]  = 'descriptionurlshort';
        }
        if ($this->isColumnModified(MediaTableMap::COL_IMAGEDESCRIPTION)) {
            $modifiedColumns[':p' . $index++]  = 'imagedescription';
        }
        if ($this->isColumnModified(MediaTableMap::COL_DATETIMEORIGINAL)) {
            $modifiedColumns[':p' . $index++]  = 'datetimeoriginal';
        }
        if ($this->isColumnModified(MediaTableMap::COL_ARTIST)) {
            $modifiedColumns[':p' . $index++]  = 'artist';
        }
        if ($this->isColumnModified(MediaTableMap::COL_LICENSESHORTNAME)) {
            $modifiedColumns[':p' . $index++]  = 'licenseshortname';
        }
        if ($this->isColumnModified(MediaTableMap::COL_USAGETERMS)) {
            $modifiedColumns[':p' . $index++]  = 'usageterms';
        }
        if ($this->isColumnModified(MediaTableMap::COL_ATTRIBUTIONREQUIRED)) {
            $modifiedColumns[':p' . $index++]  = 'attributionrequired';
        }
        if ($this->isColumnModified(MediaTableMap::COL_RESTRICTIONS)) {
            $modifiedColumns[':p' . $index++]  = 'restrictions';
        }
        if ($this->isColumnModified(MediaTableMap::COL_TIMESTAMP)) {
            $modifiedColumns[':p' . $index++]  = 'timestamp';
        }
        if ($this->isColumnModified(MediaTableMap::COL_USER)) {
            $modifiedColumns[':p' . $index++]  = 'user';
        }
        if ($this->isColumnModified(MediaTableMap::COL_USERID)) {
            $modifiedColumns[':p' . $index++]  = 'userid';
        }
        if ($this->isColumnModified(MediaTableMap::COL_MISSING)) {
            $modifiedColumns[':p' . $index++]  = 'missing';
        }
        if ($this->isColumnModified(MediaTableMap::COL_KNOWN)) {
            $modifiedColumns[':p' . $index++]  = 'known';
        }
        if ($this->isColumnModified(MediaTableMap::COL_IMAGEREPOSITORY)) {
            $modifiedColumns[':p' . $index++]  = 'imagerepository';
        }
        if ($this->isColumnModified(MediaTableMap::COL_CREATED_AT)) {
            $modifiedColumns[':p' . $index++]  = 'created_at';
        }
        if ($this->isColumnModified(MediaTableMap::COL_UPDATED_AT)) {
            $modifiedColumns[':p' . $index++]  = 'updated_at';
        }

        $sql = sprintf(
            'INSERT INTO media (%s) VALUES (%s)',
            implode(', ', $modifiedColumns),
            implode(', ', array_keys($modifiedColumns))
        );

        try {
            $stmt = $con->prepare($sql);
            foreach ($modifiedColumns as $identifier => $columnName) {
                switch ($columnName) {
                    case 'id':
                        $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                        break;
                    case 'source_id':
                        $stmt->bindValue($identifier, $this->source_id, PDO::PARAM_INT);
                        break;
                    case 'pageid':
                        $stmt->bindValue($identifier, $this->pageid, PDO::PARAM_INT);
                        break;
                    case 'title':
                        $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
                        break;
                    case 'url':
                        $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR);
                        break;
                    case 'mime':
                        $stmt->bindValue($identifier, $this->mime, PDO::PARAM_STR);
                        break;
                    case 'width':
                        $stmt->bindValue($identifier, $this->width, PDO::PARAM_INT);
                        break;
                    case 'height':
                        $stmt->bindValue($identifier, $this->height, PDO::PARAM_INT);
                        break;
                    case 'size':
                        $stmt->bindValue($identifier, $this->size, PDO::PARAM_INT);
                        break;
                    case 'sha1':
                        $stmt->bindValue($identifier, $this->sha1, PDO::PARAM_STR);
                        break;
                    case 'thumburl':
                        $stmt->bindValue($identifier, $this->thumburl, PDO::PARAM_STR);
                        break;
                    case 'thumbmime':
                        $stmt->bindValue($identifier, $this->thumbmime, PDO::PARAM_STR);
                        break;
                    case 'thumbwidth':
                        $stmt->bindValue($identifier, $this->thumbwidth, PDO::PARAM_INT);
                        break;
                    case 'thumbheight':
                        $stmt->bindValue($identifier, $this->thumbheight, PDO::PARAM_INT);
                        break;
                    case 'thumbsize':
                        $stmt->bindValue($identifier, $this->thumbsize, PDO::PARAM_INT);
                        break;
                    case 'descriptionurl':
                        $stmt->bindValue($identifier, $this->descriptionurl, PDO::PARAM_STR);
                        break;
                    case 'descriptionurlshort':
                        $stmt->bindValue($identifier, $this->descriptionurlshort, PDO::PARAM_STR);
                        break;
                    case 'imagedescription':
                        $stmt->bindValue($identifier, $this->imagedescription, PDO::PARAM_STR);
                        break;
                    case 'datetimeoriginal':
                        $stmt->bindValue($identifier, $this->datetimeoriginal, PDO::PARAM_STR);
                        break;
                    case 'artist':
                        $stmt->bindValue($identifier, $this->artist, PDO::PARAM_STR);
                        break;
                    case 'licenseshortname':
                        $stmt->bindValue($identifier, $this->licenseshortname, PDO::PARAM_STR);
                        break;
                    case 'usageterms':
                        $stmt->bindValue($identifier, $this->usageterms, PDO::PARAM_STR);
                        break;
                    case 'attributionrequired':
                        $stmt->bindValue($identifier, $this->attributionrequired, PDO::PARAM_STR);
                        break;
                    case 'restrictions':
                        $stmt->bindValue($identifier, $this->restrictions, PDO::PARAM_STR);
                        break;
                    case 'timestamp':
                        $stmt->bindValue($identifier, $this->timestamp ? $this->timestamp->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR);
                        break;
                    case 'user':
                        $stmt->bindValue($identifier, $this->user, PDO::PARAM_STR);
                        break;
                    case 'userid':
                        $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT);
                        break;
                    case 'missing':
                        $stmt->bindValue($identifier, $this->missing, PDO::PARAM_BOOL);
                        break;
                    case 'known':
                        $stmt->bindValue($identifier, $this->known, PDO::PARAM_BOOL);
                        break;
                    case 'imagerepository':
                        $stmt->bindValue($identifier, $this->imagerepository, PDO::PARAM_STR);
                        break;
                    case 'created_at':
                        $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR);
                        break;
                    case 'updated_at':
                        $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s.u") : null, PDO::PARAM_STR);
                        break;
                }
            }
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
        }

        try {
            $pk = $con->lastInsertId();
        } catch (Exception $e) {
            throw new PropelException('Unable to get autoincrement id.', 0, $e);
        }
        $this->setId($pk);

        $this->setNew(false);
    }
985453
protected function insertIntoDatabase(Entity $entity)
    {
        $primaryKey = $this->mapper->getPrimaryKey($this->getTable());
        $values = $entity->getModifiedRowData();
        $this->connection->query(
            'INSERT INTO %n %v',
            $this->getTable(),
            $values
        );
        return isset($values[$primaryKey]) ? $values[$primaryKey] : $this->connection->getInsertId();
    }
1245004
public function afterSave(Event $event, EntityInterface $entity) {
		if ($this->getConfig('uploadOn') === 'afterSave') {
			$this->_handleFiles($entity);
		}
	}
1158958
public function initialiseEntity(EntityInterface $entity): void
    {
        $entity->ensureMetaDataIsSet($this->entityManager);
        $this->addListenerToEntityIfRequired($entity);
        $this->entityDependencyInjector->injectEntityDependencies($entity);
        $debugInitMethod = $entity::getDoctrineStaticMeta()
                                  ->getReflectionClass()
                                  ->getMethod(UsesPHPMetaDataInterface::METHOD_DEBUG_INIT);
        $debugInitMethod->setAccessible(true);
        $debugInitMethod->invoke($entity);
    }
402342
def save_entity_signal_handler(sender, instance, **kwargs):
    
    if instance.__class__ in entity_registry.entity_registry:
        sync_entities(instance)

    if instance.__class__ in entity_registry.entity_watching:
        sync_entities_watching(instance)
408770
protected function placeHandler($signalNumber, callable $handler, $placement)
    {
        if (! isset($this->handlers[$signalNumber])) {
            $this->handlers[$signalNumber] = [];
            $this->registerHandler($signalNumber, $this);
        }

        switch ($placement) {
            case 'set':
                $this->handlers[$signalNumber] = [$handler];
                break;

            case 'append':
                array_push($this->handlers[$signalNumber], $handler);
                break;

            case 'prepend':
                array_unshift($this->handlers[$signalNumber], $handler);
                break;
        }
    }
553690
public function notify($eventType, MvcInterface $entity) {
        $this->setEntity($entity);
        switch($eventType) {
            case self::EVENT_UPLOAD_FILE_CREATE:
                $this->processUploads(true);
                break;
            case self::EVENT_UPLOAD_FILE_UPDATE:
                $this->processUploads(false);
                break;
        }
    }
610418
public function insert($entity)
    {
        $data     = $this->builder->reduce($entity);
        $entityId = $this->entityRegistry->getEntityId($entity);

        #try
        #{
        $this->connection->insert($this->tableName, $data);

        if (empty($entityId)) {
            $this->entityRegistry->setEntityId($entity, $this->connection->lastInsertId());
        }

        $this->builder->resolve($entity);
        #}
        #catch (\Exception $e)
        #{
        #	throw new OrmException("Entity with id {$entityId} already exists.\n" . $e->getMessage(), 0, $e);
        #}
    }
479459
public function afterSave(Event $event, EntityInterface $entity, $options) {
		$this->dispatchEvent('FileStorage.afterSave', [
			'entity' => $entity,
			'storageAdapter' => $this->getStorageAdapter($entity->get('adapter'))
		], $this->_table);
	}
397983
public function insert(EntityInterface $entity)
	{
		$sql = <<<EOT
INSERT INTO `$this->tableName` (`Name`, `Description`, `Created`) 
VALUES ( :name , :description , :created )
EOT;

		$stmt = $this->pdo->prepare($sql);
		$stmt->bindParam(':name', $entity->getName(), \PDO::PARAM_STR);
		$stmt->bindParam(':description', $entity->getDescription(), \PDO::PARAM_STR);
		$stmt->bindParam(':created', $entity->getCreatedRfc3339(), \PDO::PARAM_STR);
		$res = $stmt->execute();

		if ($res === false || $stmt->rowCount() !== 1) {
			return false;
		}

		$entity->setProjectId($this->pdo->lastInsertId());

		return $entity;
	}
384387
public function afterDelete(Event $event, EntityInterface $entity) {
		if ($this->_checkEvent($event)) {
			$event->result = $this->_deleteFile($event);
			$event->stopPropagation();
		}
	}
577802
public function beforeSave(Event $event, EntityInterface $entity)
    {
        $driver = $this->_table->connection()->driver();

        foreach ($this->config('fields') as $field => $type) {
            if (!$entity->has($field)) {
                continue;
            }

            $raw = $entity->get($field);
            $plain = Type::build($type)->toDatabase($raw, $driver);
            $entity->set($field, $this->encrypt($plain));
        }
    }
547594
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\UpdateContentMetadataSignal) {
            return;
        }

        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($signal->contentId);
        if (!$contentInfo->isPublished) {
            return;
        }
        $this->searchHandler->indexContent(
            $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo)
        );
        $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($contentInfo->mainLocationId));
    }
995680
public function add($entity)
    {
        foreach ($this->restrictions as $preset) {
            if ($preset['op'] == Operator::EQUAL) {
                $property          = Normalise::toVariable($preset['field']);
                $entity->$property = $preset['value'];
            }
        }

        $this->unitOfWork->scheduleForInsertion($entity);
    }