original_string: protected function getFormEntity(Request $request)
      {
          if ($this->formEntity === null) {
              $entityId = $request->get('id');
              $repository = $this->getRepository();
              $entity = null;
              $id = 0;
  
              if (!empty($entityId) && $entityId !== null) {
                  $entity = $repository->findOneById($entityId);
                  $id = $entity->getId();
              }
  
              if (!is_object($entity) || empty($id)) {
                  // new form, return empty entity
                  $entity_class_name = $repository->getClassName();
                  $entity = new $entity_class_name();
              }
  
              $this->formEntity = $entity;
          }
  
          return $this->formEntity;
      }
code: protected function getFormEntity(Request $request)
      {
          if ($this->formEntity === null) {
              $entityId = $request->get('id');
              $repository = $this->getRepository();
              $entity = null;
              $id = 0;
  
              if (!empty($entityId) && $entityId !== null) {
                  $entity = $repository->findOneById($entityId);
                  $id = $entity->getId();
              }
  
              if (!is_object($entity) || empty($id)) {
                  // new form, return empty entity
                  $entity_class_name = $repository->getClassName();
                  $entity = new $entity_class_name();
              }
  
              $this->formEntity = $entity;
          }
  
          return $this->formEntity;
      }
code_tokens: protected function getFormEntity ( Request $ request ) { if ( $ this -> formEntity === null ) { $ entityId = $ request -> get ( 'id' ) ; $ repository = $ this -> getRepository ( ) ; $ entity = null ; $ id = 0 ; if ( ! empty ( $ entityId ) && $ entityId !== null ) { $ entity = $ repository -> findOneById ( $ entityId ) ; $ id = $ entity -> getId ( ) ; } if ( ! is_object ( $ entity ) || empty ( $ id ) ) { // new form, return empty entity $ entity_class_name = $ repository -> getClassName ( ) ; $ entity = new $ entity_class_name ( ) ; } $ this -> formEntity = $ entity ; } return $ this -> formEntity ; }
docstring: Entity object for the form
  Dont load the object twice and load from this method
  
  @return Object
docstring_tokens: Entity object for the form Dont load the object twice and load from this method