PHP Class Bolt\Storage\EntityManager

Legacy methods:
Inheritance: implements Bolt\Storage\EntityManagerInterface
显示文件 Open project: bolt/bolt Class Usage Examples

Protected Properties

Property Type Description
$aliases array
$builder Bolt\Storage\Entity\Builder
$collectionManager Bolt\Storage\Collection\CollectionManager
$conn Doctrine\DBAL\Connection
$defaultRepositoryFactory Callable
$eventManager Symfony\Component\EventDispatcher\EventDispatcherInterface
$fieldManager FieldManager
$legacyService Bolt\Storage\ContentLegacyService
$legacyStorage Bolt\Legacy\Storage
$logger Psr\Log\LoggerInterface
$mapping Bolt\Storage\Mapping\MetadataDriver
$repositories array

Public Methods

Method Description
__call ( string $method, string $args ) : mixed Magic call method acts as a catchall proxy to the legacy repository
__construct ( Doctrine\DBAL\Connection $conn, Symfony\Component\EventDispatcher\EventDispatcherInterface $eventManager, MetadataDriver $mapping, Psr\Log\LoggerInterface $logger = null ) Creates a new EntityManager that operates on the given database connection and uses the given EventManager.
addEntityAlias ( string $alias, string $namespace ) Registers shorter alias access for Entities.
create ( string $className, array $data, Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata = null ) : Bolt\Storage\Entity\Entity Creates an entity of the given class, with the data supplied.
createCollection ( $className ) : mixed Shorthand access method to create collection. Consults aliases to allow short names.
createExpressionBuilder ( ) : Doctrine\DBAL\Query\Expression\ExpressionBuilder
createQueryBuilder ( ) : Doctrine\DBAL\Query\QueryBuilder
delete ( object $object ) : boolean Removes an object instance.
find ( string $className, mixed $id ) : object Finds an object by its identifier.
getCollectionManager ( ) : Bolt\Storage\Collection\CollectionManager
getConnection ( ) : Doctrine\DBAL\Connection Gets the DBAL Driver Connection.
getContent ( string $textquery, array $parameters = [], array &$pager = [], array $whereparameters = [] ) : Content | Content[] Note that this method is explicitly defined here because the magic method above cannot pass dynamic variables by reference
getDefaultRepositoryFactory ( Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetadata ) : callable Returns the default repository factory set on this object
getEntityBuilder ( string $className = null, Bolt\Storage\Mapping\ClassMetadata $classMetadata = null ) : Builder Get an entity builder instance for a given class.
getEventManager ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface Gets the Event Manager.
getFieldManager ( ) : FieldManager
getLogger ( ) : Psr\Log\LoggerInterface Getter for logger object
getMapper ( ) : MetadataDriver Gets the Class Metadata Driver.
getRepository ( $className )
legacy ( ) : Storage Returns a proxy to the legacy storage service
save ( object $object ) : boolean The object will be entered into the database as a result of this operation.
setCollectionManager ( Bolt\Storage\Collection\CollectionManager $collectionManager )
setDefaultRepositoryFactory ( callable $factory ) Sets a default repository factory that can handle metadata that is not mapped to a specific entity.
setEntityBuilder ( Builder $builder ) : Builder Set an entity builder instance.
setFieldManager ( FieldManager $fieldManager )
setLegacyService ( Bolt\Storage\ContentLegacyService $service ) Sets the LegacyRepository
setLegacyStorage ( Storage $storage ) Sets the LegacyRepository
setRepository ( string $entityName, string $repositoryClass ) Sets a custom repository class for an entity.

Method Details

__call() public method

Magic call method acts as a catchall proxy to the legacy repository
public __call ( string $method, string $args ) : mixed
$method string
$args string
return mixed

__construct() public method

Creates a new EntityManager that operates on the given database connection and uses the given EventManager.
public __construct ( Doctrine\DBAL\Connection $conn, Symfony\Component\EventDispatcher\EventDispatcherInterface $eventManager, MetadataDriver $mapping, Psr\Log\LoggerInterface $logger = null )
$conn Doctrine\DBAL\Connection
$eventManager Symfony\Component\EventDispatcher\EventDispatcherInterface
$mapping Bolt\Storage\Mapping\MetadataDriver
$logger Psr\Log\LoggerInterface

addEntityAlias() public method

For example ->addEntityAlias('user', 'Project\Bundle\Module\Entity\User') would allow ->getRepository('user')
public addEntityAlias ( string $alias, string $namespace )
$alias string
$namespace string

create() public method

Creates an entity of the given class, with the data supplied.
public create ( string $className, array $data, Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata = null ) : Bolt\Storage\Entity\Entity
$className string The type of entity to create
$data array The data to use to hydrate the new entity
$metadata Doctrine\Common\Persistence\Mapping\ClassMetadata
return Bolt\Storage\Entity\Entity

createCollection() public method

Shorthand access method to create collection. Consults aliases to allow short names.
public createCollection ( $className ) : mixed
$className
return mixed

createExpressionBuilder() public method

public createExpressionBuilder ( ) : Doctrine\DBAL\Query\Expression\ExpressionBuilder
return Doctrine\DBAL\Query\Expression\ExpressionBuilder

createQueryBuilder() public method

public createQueryBuilder ( ) : Doctrine\DBAL\Query\QueryBuilder
return Doctrine\DBAL\Query\QueryBuilder

delete() public method

Passed in object will be removed from the database as a result of this operation.
public delete ( object $object ) : boolean
$object object The object instance to remove.
return boolean

find() public method

This is just a convenient shortcut for getRepository($className)->find($id).
public find ( string $className, mixed $id ) : object
$className string The class name of the object to find.
$id mixed The identity of the object to find.
return object The found object.

getCollectionManager() public method

public getCollectionManager ( ) : Bolt\Storage\Collection\CollectionManager
return Bolt\Storage\Collection\CollectionManager

getConnection() public method

Gets the DBAL Driver Connection.
public getConnection ( ) : Doctrine\DBAL\Connection
return Doctrine\DBAL\Connection

getContent() public method

Note that this method is explicitly defined here because the magic method above cannot pass dynamic variables by reference
public getContent ( string $textquery, array $parameters = [], array &$pager = [], array $whereparameters = [] ) : Content | Content[]
$textquery string
$parameters array
$pager array
$whereparameters array
return Bolt\Legacy\Content | Bolt\Legacy\Content[]

getDefaultRepositoryFactory() public method

Returns the default repository factory set on this object
public getDefaultRepositoryFactory ( Doctrine\Common\Persistence\Mapping\ClassMetadata $classMetadata ) : callable
$classMetadata Doctrine\Common\Persistence\Mapping\ClassMetadata
return callable $factory

getEntityBuilder() public method

Get an entity builder instance for a given class.
public getEntityBuilder ( string $className = null, Bolt\Storage\Mapping\ClassMetadata $classMetadata = null ) : Builder
$className string
$classMetadata Bolt\Storage\Mapping\ClassMetadata
return Bolt\Storage\Entity\Builder

getEventManager() public method

Gets the Event Manager.
public getEventManager ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
return Symfony\Component\EventDispatcher\EventDispatcherInterface

getFieldManager() public method

public getFieldManager ( ) : FieldManager
return FieldManager

getLogger() public method

Getter for logger object
public getLogger ( ) : Psr\Log\LoggerInterface
return Psr\Log\LoggerInterface

getMapper() public method

Gets the Class Metadata Driver.
public getMapper ( ) : MetadataDriver
return Bolt\Storage\Mapping\MetadataDriver

getRepository() public method

public getRepository ( $className )

legacy() public method

Returns a proxy to the legacy storage service
public legacy ( ) : Storage
return Bolt\Legacy\Storage

save() public method

The object will be entered into the database as a result of this operation.
public save ( object $object ) : boolean
$object object The instance to persist to storage.
return boolean

setCollectionManager() public method

public setCollectionManager ( Bolt\Storage\Collection\CollectionManager $collectionManager )
$collectionManager Bolt\Storage\Collection\CollectionManager

setDefaultRepositoryFactory() public method

Sets a default repository factory that can handle metadata that is not mapped to a specific entity.
public setDefaultRepositoryFactory ( callable $factory )
$factory callable

setEntityBuilder() public method

Set an entity builder instance.
public setEntityBuilder ( Builder $builder ) : Builder
$builder Bolt\Storage\Entity\Builder
return Bolt\Storage\Entity\Builder

setFieldManager() public method

public setFieldManager ( FieldManager $fieldManager )
$fieldManager FieldManager

setLegacyService() public method

Sets the LegacyRepository
public setLegacyService ( Bolt\Storage\ContentLegacyService $service )
$service Bolt\Storage\ContentLegacyService

setLegacyStorage() public method

Sets the LegacyRepository
public setLegacyStorage ( Storage $storage )
$storage Bolt\Legacy\Storage

setRepository() public method

Sets a custom repository class for an entity.
public setRepository ( string $entityName, string $repositoryClass )
$entityName string
$repositoryClass string

Property Details

$aliases protected_oe property

protected array $aliases
return array

$builder protected_oe property

protected Builder,Bolt\Storage\Entity $builder
return Bolt\Storage\Entity\Builder

$collectionManager protected_oe property

protected CollectionManager,Bolt\Storage\Collection $collectionManager
return Bolt\Storage\Collection\CollectionManager

$conn protected_oe property

protected Connection,Doctrine\DBAL $conn
return Doctrine\DBAL\Connection

$defaultRepositoryFactory protected_oe property

protected Callable $defaultRepositoryFactory
return Callable

$eventManager protected_oe property

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $eventManager
return Symfony\Component\EventDispatcher\EventDispatcherInterface

$fieldManager protected_oe property

protected FieldManager,Bolt\Storage $fieldManager
return FieldManager

$legacyService protected_oe property

protected ContentLegacyService,Bolt\Storage $legacyService
return Bolt\Storage\ContentLegacyService

$legacyStorage protected_oe property

protected Storage,Bolt\Legacy $legacyStorage
return Bolt\Legacy\Storage

$logger protected_oe property

protected LoggerInterface,Psr\Log $logger
return Psr\Log\LoggerInterface

$mapping protected_oe property

protected MetadataDriver,Bolt\Storage\Mapping $mapping
return Bolt\Storage\Mapping\MetadataDriver

$repositories protected_oe property

protected array $repositories
return array