[TYPO3-mvc] Abstract Classes and the DB

Zalán Somogyváry zalan at gmx.net
Sat May 14 01:20:51 CEST 2011


Hello Lienhart,

Am 13.05.2011 um 15:13 schrieb Lienhart Woitok:

> Hello Zalán,
> 
> I never tried it with concrete table inheritance, but I don't think this works with a central repository in Extbase. Please try single table inheritance, that should definitely work.


It does not work. I've tried several versions. Even renamed the classes to a name without Abstract but all that did not help.

Here is my static setup.txt:

plugin.myextension.persistence.classes {
	Tx_MyExtension_Domain_Model_MediaItem {
		mapping {
			tableName = tx_myextension_domain_model_mediaitem
			recordType = Tx_MyExtension_Domain_Model_MediaItem
		}
		subclasses {
			Tx_MyExtension_Domain_Model_MediaFile = Tx_MyExtension_Domain_Model_MediaFile
		}
	}
	Tx_MyExtension_Domain_Model_MediaFile {
		mapping {
			tableName = tx_myextension_domain_model_mediaitem
			recordType = Tx_MyExtension_Domain_Model_MediaFile
			columns {
				uri.mapOnProperty = path
			}
		}
		subclasses {
			Tx_MyExtension_Domain_Model_Image = Tx_MyExtension_Domain_Model_Image
		}
	}
	Tx_MyExtension_Domain_Model_Image {
		mapping {
			tableName = tx_myextension_domain_model_mediaitem
			recordType = Tx_MyExtension_Domain_Model_Image
		}
	}
}

I've var_dumped everything I got back from my Tx_MyExtension_Domain_Repository_MediaItemRepository, here are some parts of this dump:

object(Tx_Extbase_Persistence_QueryResult)[362]
  private 'warning' => string 'You should never see this warning. If you do, you probably used PHP array functions like current() on the Tx_Extbase_Persistence_QueryResult. To retrieve the first result, you can use the getFirst() method.' (length=206)
(...) than later on...
protected 'repositoryClassNames' => 
        array
          0 => string 'Tx_TuBaCore_Domain_Repository_MediaItemRepository' (length=49)
  protected 'query' => 
    object(Tx_Extbase_Persistence_Query)[399]
      protected 'type' => string 'Tx_TuBaCore_Domain_Model_MediaItem' (length=34)

but at the end... ;(
     protected 'qomFactory' => 
        object(Tx_Extbase_Persistence_QOM_QueryObjectModelFactory)[91]
          protected 'objectManager' => 
            object(Tx_Extbase_Object_ObjectManager)[31]
              ...
      protected 'source' => null
      protected 'constraint' => null
      protected 'statement' => null
      protected 'orderings' => 
        array
          empty
      protected 'limit' => null
      protected 'offset' => null
      protected 'querySettings' => 
        object(Tx_Extbase_Persistence_Typo3QuerySettings)[385]
          protected 'respectStoragePage' => boolean true
          protected 'storagePageIds' => 
            array
              ...
          protected 'respectEnableFields' => boolean true
          protected 'respectSysLanguage' => boolean true
          protected 'returnRawQueryResult' => boolean false
  protected 'queryResult' => null
I admit that I don't really understand the whole of it by now... Maybe someone has better knowledge of this internals than I and could give me a hint?

Best regards,
Zalán Somogyváry


More information about the TYPO3-project-typo3v4mvc mailing list