I recently needed to sort query results to match the order of IDs passed to it for use in a WHERE … IN() clause. In MySQL, this can be done using the FIELD() function in the ORDERY BY clause. For Doctrine, which doesn’t have the FIELD() function and doesn’t allow functions in the ORDER BY clause, there’s a little more work needed to make use of it.
I’ve been unhappy with the inheritance provided by PHP ORM’s I’ve looked at. In looking for something better, I discovered that Postgres has built in inheritance, because it is an object-relational database.
each file is stored in two databases: the normal hierchical db and an objective db. The hierarchical db is used for speed and for compatibility with current file systems. The objective db is used for metadata and other information less critical to basic file operations.
The objective db contains much of the metadata (non file operation related stuff). Each file type is an object type in the database, inheriting from the basic file object or one of its children. Each file type will have its own attributes as well as actions related to it. The actions may consist only of OS functions related to it, may also include application calls, and could even include user/other created scripts and functions related to the file type. The actions would provide the data from the file to the system or other function that is necessary for it to operate (functions and applications would all have a defined standard interface to them).