DatabaseStructureManager
class DatabaseStructureManager (View source)
Properties
protected EntityManagerInterface | $entityManager | The entity manager instance. |
|
protected ClassMetadata[]|null | $metadatas | The entity classes and their metadata. |
Methods
Create a new structure manager.
Get the entity manager object for this structure manager.
Returns the proxies path.
Generates the proxy classes for all the entities managed by this class.
Generates the proxy classes for all given classes contained in the $metadatas array. Returns true on successful generation and false if there were no proxy classes to be generated.
Destroys all the proxy classes that have the defined prefix. No need to define the generic doctrine proxy marker prefix, i.e. "CG" but the part after that, e.g. "ConcreteCore".
Installs the database tables according to the entity schema definitions.
Installs the database tables for all entity classes contained within the $metadatas array. Returns true if new tables were created or existing ones altered. Otherwise this will return false if there were no database migrations needed.
This drops all the tables related to the entities managed by this class.
Uninstalls the database tables for all given entity classes contained within the $metadatas array. Returns true if there were tables that were dropped and false otherwise.
Drops all the database tables that a) are prefixed with the given prefix string b) are not linked to any existing entity managed by this class c) are not contained within the $excludeTables array.
Determines whether the entity manager instance for this class has any entity classes defined in its entity class path.
Returns the entity classes and their metadata. Loads this data if it has not been already loaded by this instancfe.
Loads the entity class metadata into the $metadatas variable.
No description
Clears cache, regenerates all proxy classes, and updates metadatas in all entity managers
Details
__construct(EntityManagerInterface $em)
Create a new structure manager.
EntityManagerInterface
getEntityManager()
Get the entity manager object for this structure manager.
string
getProxyDir()
Returns the proxies path.
bool
generateProxyClasses()
Generates the proxy classes for all the entities managed by this class.
Returns true on successful generation and false if there were no proxy classes to be generated.
bool
generateProxyClassesFor(array $metadatas)
Generates the proxy classes for all given classes contained in the $metadatas array. Returns true on successful generation and false if there were no proxy classes to be generated.
bool
destroyProxyClasses(string $prefix = null)
Destroys all the proxy classes that have the defined prefix. No need to define the generic doctrine proxy marker prefix, i.e. "CG" but the part after that, e.g. "ConcreteCore".
Returns a boolean indicating whether any files were deleted or not.
bool
installDatabase()
Installs the database tables according to the entity schema definitions.
This will not install any existing tables but it will migrate those tables to match the current schema definitions for the classes.
bool
installDatabaseFor(array $metadatas, Closure $queryFilter = null)
Installs the database tables for all entity classes contained within the $metadatas array. Returns true if new tables were created or existing ones altered. Otherwise this will return false if there were no database migrations needed.
bool
uninstallDatabase()
This drops all the tables related to the entities managed by this class.
Do not normally call this for anything. Save this ONLY for special occasions.
bool
uninstallDatabaseFor(array $metadatas)
Uninstalls the database tables for all given entity classes contained within the $metadatas array. Returns true if there were tables that were dropped and false otherwise.
int
dropObsoleteDatabaseTables(string $prefix, array $excludeTables = array())
Drops all the database tables that a) are prefixed with the given prefix string b) are not linked to any existing entity managed by this class c) are not contained within the $excludeTables array.
Can be used e.g. for packages by giving the package's handle in camelcased format. This would drop all the prefixed database tables for that package that no longer have a corresponding entity defined for them. Give the tables defined in the package's DB XML in the $excludeTables array in order not to drop them.
bool
hasEntities()
Determines whether the entity manager instance for this class has any entity classes defined in its entity class path.
ClassMetadata[]
getMetadatas()
Returns the entity classes and their metadata. Loads this data if it has not been already loaded by this instancfe.
protected
loadMetadatas()
Loads the entity class metadata into the $metadatas variable.
clearCacheAndProxies()
No description
refreshEntities()
Clears cache, regenerates all proxy classes, and updates metadatas in all entity managers