lib/Psc/CMS/Controller/ContentStreamController.php
public function prepareFor(ContentStreamAware $entity, $type, $locale, $revision = 'default', $save = TRUE) {
    try {
      $contentStream = 
         $entity->getContentStream()
           ->locale($locale)
           ->type($type)
           ->revision($revision)
           ->one()
       ;
     } catch (NoContentStreamsFoundException $e) {
       $contentStream = 
         $this->createEmptyEntity($revision)
           ->setLocale($locale)
           ->setRevision($revision)
           ->setType($type);

       $entity->addContentStream($contentStream);

       
       if ($save) {
         $this->repository->save($contentStream);
         $this->repository->persist($entity);
       }
     }

    return $contentStream;
  }
public function prepareFor(ContentStreamAware $entity, $type, $locale, $revision = 'default', $save = TRUE) {
    try {
      $contentStream = 
         $entity->getContentStream()
           ->locale($locale)
           ->type($type)
           ->revision($revision)
           ->one()
       ;
     } catch (NoContentStreamsFoundException $e) {
       $contentStream = 
         $this->createEmptyEntity($revision)
           ->setLocale($locale)
           ->setRevision($revision)
           ->setType($type);

       $entity->addContentStream($contentStream);

       
       if ($save) {
         $this->repository->save($contentStream);
         $this->repository->persist($entity);
       }
     }

    return $contentStream;
  }
public function prepareFor ( ContentStreamAware $ entity , $ type , $ locale , $ revision = 'default' , $ save = TRUE ) { try { $ contentStream = $ entity -> getContentStream ( ) -> locale ( $ locale ) -> type ( $ type ) -> revision ( $ revision ) -> one ( ) ; } catch ( NoContentStreamsFoundException $ e ) { $ contentStream = $ this -> createEmptyEntity ( $ revision ) -> setLocale ( $ locale ) -> setRevision ( $ revision ) -> setType ( $ type ) ; $ entity -> addContentStream ( $ contentStream ) ; if ( $ save ) { $ this -> repository -> save ( $ contentStream ) ; $ this -> repository -> persist ( $ entity ) ; } } return $ contentStream ; }
Adds or returns a new ContentStream for the entity

@param bool $save per default the new contentStream (if created) is persisted and the em is flushed(!)
@return ContentStream (created or fetched from db)
Adds or returns a new ContentStream for the entity