private function saveContentRecord(Entity\Content $content, $oldContent, $contentType, $new, $comment, $returnTo, $editReferrer)
    {
        // Save the record
        $repo = $this->em->getRepository($contentType['slug']);

        // Update the date modified timestamp
        $content->setDatechanged('now');

        $repo->save($content);
        $id = $content->getId();

        // Create the change log entry if configured
        $this->logChange($contentType, $content->getId(), $content, $oldContent, $comment);

        // Log the change
        if ($new) {
            $this->loggerFlash->success(Trans::__('contenttypes.generic.saved-new', ['%contenttype%' => $contentType['singular_name']]));
            $this->loggerSystem->info('Created: ' . $content->getTitle(), ['event' => 'content']);
        } else {
            $this->loggerFlash->success(Trans::__('contenttypes.generic.saved-changes', ['%contenttype%' => $contentType['singular_name']]));
            $this->loggerSystem->info('Saved: ' . $content->getTitle(), ['event' => 'content']);
        }

        if ($new && ($returnTo === 'save')) {
            $redirectUri = $this->generateUrl(
                'editcontent',
                [
                    'contenttypeslug' => $contentType['slug'],
                    'id'              => $id,
                ]
            );

            return new RedirectResponse($redirectUri);
        } elseif ($returnTo === 'ajax') {
            return $this->createJsonUpdate($content, true);
        } elseif ($returnTo === 'save_create') {
            $redirectUri = $this->generateUrl(
                'editcontent',
                [
                    'contenttypeslug' => $contentType['slug'],
                    '_fragment'       => $returnTo,
                ]
            );

            return new RedirectResponse($redirectUri);
        } elseif ($returnTo === 'save_return') {
            // No returnto, so we go back to the 'overview' for this contenttype.
            // check if a pager was set in the referrer - if yes go back there
            if ($editReferrer) {
                return new RedirectResponse($editReferrer);
            }

            $redirectUri = $this->generateUrl(
                'overview',
                [
                    'contenttypeslug' => $contentType['slug']
                ]
            );

            return new RedirectResponse($redirectUri);
        } elseif ($returnTo === 'test') {
            return $this->createJsonUpdate($content, false);
        }

        return null;
    }
private function saveContentRecord(Entity\Content $content, $oldContent, $contentType, $new, $comment, $returnTo, $editReferrer)
    {
        // Save the record
        $repo = $this->em->getRepository($contentType['slug']);

        // Update the date modified timestamp
        $content->setDatechanged('now');

        $repo->save($content);
        $id = $content->getId();

        // Create the change log entry if configured
        $this->logChange($contentType, $content->getId(), $content, $oldContent, $comment);

        // Log the change
        if ($new) {
            $this->loggerFlash->success(Trans::__('contenttypes.generic.saved-new', ['%contenttype%' => $contentType['singular_name']]));
            $this->loggerSystem->info('Created: ' . $content->getTitle(), ['event' => 'content']);
        } else {
            $this->loggerFlash->success(Trans::__('contenttypes.generic.saved-changes', ['%contenttype%' => $contentType['singular_name']]));
            $this->loggerSystem->info('Saved: ' . $content->getTitle(), ['event' => 'content']);
        }

        if ($new && ($returnTo === 'save')) {
            $redirectUri = $this->generateUrl(
                'editcontent',
                [
                    'contenttypeslug' => $contentType['slug'],
                    'id'              => $id,
                ]
            );

            return new RedirectResponse($redirectUri);
        } elseif ($returnTo === 'ajax') {
            return $this->createJsonUpdate($content, true);
        } elseif ($returnTo === 'save_create') {
            $redirectUri = $this->generateUrl(
                'editcontent',
                [
                    'contenttypeslug' => $contentType['slug'],
                    '_fragment'       => $returnTo,
                ]
            );

            return new RedirectResponse($redirectUri);
        } elseif ($returnTo === 'save_return') {
            // No returnto, so we go back to the 'overview' for this contenttype.
            // check if a pager was set in the referrer - if yes go back there
            if ($editReferrer) {
                return new RedirectResponse($editReferrer);
            }

            $redirectUri = $this->generateUrl(
                'overview',
                [
                    'contenttypeslug' => $contentType['slug']
                ]
            );

            return new RedirectResponse($redirectUri);
        } elseif ($returnTo === 'test') {
            return $this->createJsonUpdate($content, false);
        }

        return null;
    }
private function saveContentRecord ( Entity \ Content $ content , $ oldContent , $ contentType , $ new , $ comment , $ returnTo , $ editReferrer ) { // Save the record $ repo = $ this -> em -> getRepository ( $ contentType [ 'slug' ] ) ; // Update the date modified timestamp $ content -> setDatechanged ( 'now' ) ; $ repo -> save ( $ content ) ; $ id = $ content -> getId ( ) ; // Create the change log entry if configured $ this -> logChange ( $ contentType , $ content -> getId ( ) , $ content , $ oldContent , $ comment ) ; // Log the change if ( $ new ) { $ this -> loggerFlash -> success ( Trans :: __ ( 'contenttypes.generic.saved-new' , [ '%contenttype%' => $ contentType [ 'singular_name' ] ] ) ) ; $ this -> loggerSystem -> info ( 'Created: ' . $ content -> getTitle ( ) , [ 'event' => 'content' ] ) ; } else { $ this -> loggerFlash -> success ( Trans :: __ ( 'contenttypes.generic.saved-changes' , [ '%contenttype%' => $ contentType [ 'singular_name' ] ] ) ) ; $ this -> loggerSystem -> info ( 'Saved: ' . $ content -> getTitle ( ) , [ 'event' => 'content' ] ) ; } if ( $ new && ( $ returnTo === 'save' ) ) { $ redirectUri = $ this -> generateUrl ( 'editcontent' , [ 'contenttypeslug' => $ contentType [ 'slug' ] , 'id' => $ id , ] ) ; return new RedirectResponse ( $ redirectUri ) ; } elseif ( $ returnTo === 'ajax' ) { return $ this -> createJsonUpdate ( $ content , true ) ; } elseif ( $ returnTo === 'save_create' ) { $ redirectUri = $ this -> generateUrl ( 'editcontent' , [ 'contenttypeslug' => $ contentType [ 'slug' ] , '_fragment' => $ returnTo , ] ) ; return new RedirectResponse ( $ redirectUri ) ; } elseif ( $ returnTo === 'save_return' ) { // No returnto, so we go back to the 'overview' for this contenttype. // check if a pager was set in the referrer - if yes go back there if ( $ editReferrer ) { return new RedirectResponse ( $ editReferrer ) ; } $ redirectUri = $ this -> generateUrl ( 'overview' , [ 'contenttypeslug' => $ contentType [ 'slug' ] ] ) ; return new RedirectResponse ( $ redirectUri ) ; } elseif ( $ returnTo === 'test' ) { return $ this -> createJsonUpdate ( $ content , false ) ; } return null ; }
Commit the record to the database.

@param Entity\Content $content
@param Entity\Content|null $oldContent
@param array|ContentType $contentType
@param bool $new
@param string $comment
@param string $returnTo
@param string $editReferrer

@return Response|null
@throws InvalidRepositoryException
Commit the record to the database .