PHP 클래스 Elgg\Database\EntityTable

부터: 1.10.0
파일 보기 프로젝트 열기: elgg/elgg 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$config Elgg\Config
$db Elgg\Database
$entity_cache Elgg\Cache\EntityCache
$entity_preloader Elgg\EntityPreloader
$events Elgg\EventsService
$logger Elgg\Logger
$metadata_cache Elgg\Cache\MetadataCache
$session ElggSessio\ElggSession
$subtype_table SubtypeTable
$table string
$translator Elgg\I18n\Translator

공개 메소드들

메소드 설명
__construct ( Config $config, Database $db, EntityCache $entity_cache, MetadataCache $metadata_cache, SubtypeTable $subtype_table, EventsService $events, ElggSessio\ElggSession $session, Translator $translator, Logger $logger ) Constructor
disableEntities ( integer $owner_guid ) : boolean Disables all entities owned and contained by a user (or another entity)
enable ( integer $guid, boolean $recursive = true ) : boolean Enable an entity.
exists ( integer $guid ) : boolean Does an entity exist?
fetchFromSql ( string $sql, ElggBatch $batch = null ) : ElggEntit\ElggEntity[] Return entities from an SQL query generated by elgg_get_entities.
get ( integer $guid, string $type = '' ) : ElggEntit\ElggEntity | stdClas\stdClass | false Loads and returns an entity object from a guid.
getDates ( string $type = '', string $subtype = '', integer $container_guid, string $order_by = 'time_created' ) : array | false Returns a list of months in which entities were updated or created.
getEntities ( array $options = [] ) : ElggEntity[] | integer | mixed Returns an array of entities with optional filtering.
getEntitiesFromAttributes ( array $options = [] ) : ElggEntit\ElggEntity[] | mixed Gets entities based upon attributes in secondary tables.
getEntityAttributeWhereSql ( array $options = [] ) : false | array Get the join and where clauses for working with entity attributes
getEntityTimeWhereSql ( string $table, null | integer $time_created_upper = null, null | integer $time_created_lower = null, null | integer $time_updated_upper = null, null | integer $time_updated_lower = null ) : false | string Returns SQL where clause for entity time limits.
getEntityTypeSubtypeWhereSql ( string $table, null | array $types, null | array $subtypes, null | array $pairs ) : false | string Returns SQL where clause for type and subtype on main entity table
getGuidBasedWhereSql ( string $column, null | array $guids ) : false | string Returns SQL where clause for owner and containers.
getRow ( integer $guid, integer $user_guid = null ) : stdClas\stdClass | false Returns a database row from the entities table.
getUserForPermissionsCheck ( integer $guid ) : ElggUse\ElggUser | false Get a user by GUID even if the entity is hidden or disabled
insertRow ( stdClas\stdClass $row, array $attributes = [] ) : integer | false Adds a new row to the entity table
rowToElggStar ( stdClas\stdClass $row ) : ElggEntit\ElggEntity | false Create an Elgg* object from a given entity row.
updateLastAction ( ElggEntit\ElggEntity $entity, integer $posted = null ) : integer | false Update the last_action column in the entities table for $guid.
updateRow ( integer $guid, stdClas\stdClass $row ) : integer | false Update entity table row

보호된 메소드들

메소드 설명
autoJoinTables ( array $options ) : array Decorate getEntities() options in order to auto-join secondary tables where it's safe to do so.
getFromCache ( integer $guid ) : ElggEntity Get an entity from the in-memory or memcache caches

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( Config $config, Database $db, EntityCache $entity_cache, MetadataCache $metadata_cache, SubtypeTable $subtype_table, EventsService $events, ElggSessio\ElggSession $session, Translator $translator, Logger $logger )
$config Elgg\Config Config
$db Elgg\Database Database
$entity_cache Elgg\Cache\EntityCache Entity cache
$metadata_cache Elgg\Cache\MetadataCache Metadata cache
$subtype_table SubtypeTable Subtype table
$events Elgg\EventsService Events service
$session ElggSessio\ElggSession Session
$translator Elgg\I18n\Translator Translator
$logger Elgg\Logger Logger

autoJoinTables() 보호된 메소드

Decorate getEntities() options in order to auto-join secondary tables where it's safe to do so.
protected autoJoinTables ( array $options ) : array
$options array Options array in getEntities() after normalization
리턴 array

disableEntities() 공개 메소드

Disables all entities owned and contained by a user (or another entity)
public disableEntities ( integer $owner_guid ) : boolean
$owner_guid integer The owner GUID
리턴 boolean

enable() 공개 메소드

Enable an entity.
public enable ( integer $guid, boolean $recursive = true ) : boolean
$guid integer GUID of entity to enable
$recursive boolean Recursively enable all entities disabled with the entity?
리턴 boolean

exists() 공개 메소드

This function checks for the existence of an entity independent of access permissions. It is useful for situations when a user cannot access an entity and it must be determined whether entity has been deleted or the access level has changed.
public exists ( integer $guid ) : boolean
$guid integer The GUID of the entity
리턴 boolean

fetchFromSql() 공개 메소드

Return entities from an SQL query generated by elgg_get_entities.
public fetchFromSql ( string $sql, ElggBatch $batch = null ) : ElggEntit\ElggEntity[]
$sql string
$batch ElggBatch
리턴 ElggEntit\ElggEntity[]

get() 공개 메소드

Loads and returns an entity object from a guid.
public get ( integer $guid, string $type = '' ) : ElggEntit\ElggEntity | stdClas\stdClass | false
$guid integer The GUID of the entity
$type string The type of the entity. If given, even an existing entity with the given GUID will not be returned unless its type matches.
리턴 ElggEntit\ElggEntity | stdClas\stdClass | false The correct Elgg or custom object based upon entity type and subtype

getDates() 공개 메소드

Returns a list of months in which entities were updated or created.
public getDates ( string $type = '', string $subtype = '', integer $container_guid, string $order_by = 'time_created' ) : array | false
$type string The type of entity
$subtype string The subtype of entity
$container_guid integer The container GUID that the entities belong to
$order_by string Order_by SQL order by clause
리턴 array | false Either an array months as YYYYMM, or false on failure

getEntities() 공개 메소드

Entities are the basic unit of storage in Elgg. This function provides the simplest way to get an array of entities. There are many options available that can be passed to filter what sorts of entities are returned.
또한 보기: elgg_get_entities_from_metadata()
또한 보기: elgg_get_entities_from_relationship()
또한 보기: elgg_get_entities_from_access_id()
또한 보기: elgg_get_entities_from_annotations()
또한 보기: elgg_list_entities()
또한 보기: elgg_get_entities_from_metadata()
또한 보기: elgg_get_entities_from_relationship()
또한 보기: elgg_get_entities_from_access_id()
또한 보기: elgg_get_entities_from_annotations()
또한 보기: elgg_list_entities()
public getEntities ( array $options = [] ) : ElggEntity[] | integer | mixed
$options array Array in format: types => null|STR entity type (type IN ('type1', 'type2') Joined with subtypes by AND. See below) subtypes => null|STR entity subtype (SQL: subtype IN ('subtype1', 'subtype2)) Use ELGG_ENTITIES_NO_VALUE to match the default subtype. Use ELGG_ENTITIES_ANY_VALUE to match any subtype. type_subtype_pairs => null|ARR (array('type' => 'subtype')) array( 'object' => array('blog', 'file'), // All objects with subtype of 'blog' or 'file' 'user' => ELGG_ENTITY_ANY_VALUE, // All users irrespective of subtype ); guids => null|ARR Array of entity guids owner_guids => null|ARR Array of owner guids container_guids => null|ARR Array of container_guids order_by => null (time_created desc)|STR SQL order by clause reverse_order_by => BOOL Reverse the default order by clause limit => null (10)|INT SQL limit clause (0 means no limit) offset => null (0)|INT SQL offset clause created_time_lower => null|INT Created time lower boundary in epoch time created_time_upper => null|INT Created time upper boundary in epoch time modified_time_lower => null|INT Modified time lower boundary in epoch time modified_time_upper => null|INT Modified time upper boundary in epoch time count => true|false return a count instead of entities wheres => array() Additional where clauses to AND together joins => array() Additional joins preload_owners => bool (false) If set to true, this function will preload all the owners of the returned entities resulting in better performance if those owners need to be displayed preload_containers => bool (false) If set to true, this function will preload all the containers of the returned entities resulting in better performance if those containers need to be displayed callback => string A callback function to pass each row through distinct => bool (true) If set to false, Elgg will drop the DISTINCT clause from the MySQL query, which will improve performance in some situations. Avoid setting this option without a full understanding of the underlying SQL query Elgg creates. batch => bool (false) If set to true, an Elgg\BatchResult object will be returned instead of an array. Since 2.3 batch_inc_offset => bool (true) If "batch" is used, this tells the batch to increment the offset on each fetch. This must be set to false if you delete the batched results. batch_size => int (25) If "batch" is used, this is the number of entities/rows to pull in before requesting more.
리턴 ElggEntity[] | integer | mixed If count, int. Otherwise an array or an Elgg\BatchResult. false on errors.

getEntitiesFromAttributes() 공개 메소드

Also accepts all options available to elgg_get_entities(), elgg_get_entities_from_metadata(), and elgg_get_entities_from_relationship().
또한 보기: elgg_get_entities
또한 보기: elgg_get_entities_from_metadata
또한 보기: elgg_get_entities_from_relationship
public getEntitiesFromAttributes ( array $options = [] ) : ElggEntit\ElggEntity[] | mixed
$options array Array in format: attribute_name_value_pairs => ARR ( 'name' => 'name', 'value' => 'value', 'operand' => '=', (optional) 'case_sensitive' => false (optional) ) If multiple values are sent via an array ('value' => array('value1', 'value2') the pair's operand will be forced to "IN". attribute_name_value_pairs_operator => null|STR The operator to use for combining (name = value) OPERATOR (name = value); default is AND
리턴 ElggEntit\ElggEntity[] | mixed If count, int. If not count, array. false on errors.

getEntityAttributeWhereSql() 공개 메소드

Get the join and where clauses for working with entity attributes
public getEntityAttributeWhereSql ( array $options = [] ) : false | array
$options array
리턴 false | array False on fail, array('joins', 'wheres')

getEntityTimeWhereSql() 공개 메소드

Returns SQL where clause for entity time limits.
public getEntityTimeWhereSql ( string $table, null | integer $time_created_upper = null, null | integer $time_created_lower = null, null | integer $time_updated_upper = null, null | integer $time_updated_lower = null ) : false | string
$table string Entity table prefix as defined in SELECT...FROM entities $table
$time_created_upper null | integer Time created upper limit
$time_created_lower null | integer Time created lower limit
$time_updated_upper null | integer Time updated upper limit
$time_updated_lower null | integer Time updated lower limit
리턴 false | string false on fail, string on success.

getEntityTypeSubtypeWhereSql() 공개 메소드

Returns SQL where clause for type and subtype on main entity table
public getEntityTypeSubtypeWhereSql ( string $table, null | array $types, null | array $subtypes, null | array $pairs ) : false | string
$table string Entity table prefix as defined in SELECT...FROM entities $table
$types null | array Array of types or null if none.
$subtypes null | array Array of subtypes or null if none
$pairs null | array Array of pairs of types and subtypes
리턴 false | string

getFromCache() 보호된 메소드

Get an entity from the in-memory or memcache caches
protected getFromCache ( integer $guid ) : ElggEntity
$guid integer GUID
리턴 ElggEntity

getGuidBasedWhereSql() 공개 메소드

Returns SQL where clause for owner and containers.
public getGuidBasedWhereSql ( string $column, null | array $guids ) : false | string
$column string Column name the guids should be checked against. Usually best to provide in table.column format.
$guids null | array Array of GUIDs.
리턴 false | string

getRow() 공개 메소드

Returns a database row from the entities table.
또한 보기: entity_row_to_elggstar()
public getRow ( integer $guid, integer $user_guid = null ) : stdClas\stdClass | false
$guid integer The GUID of the object to extract
$user_guid integer GUID of the user accessing the row Defaults to logged in user if null Builds an access query for a logged out user if 0
리턴 stdClas\stdClass | false

getUserForPermissionsCheck() 공개 메소드

Get a user by GUID even if the entity is hidden or disabled
public getUserForPermissionsCheck ( integer $guid ) : ElggUse\ElggUser | false
$guid integer User GUID. Default is logged in user
리턴 ElggUse\ElggUser | false

insertRow() 공개 메소드

Adds a new row to the entity table
public insertRow ( stdClas\stdClass $row, array $attributes = [] ) : integer | false
$row stdClas\stdClass Entity base information
$attributes array All primary and secondary table attributes Used by database mock services to allow mocking entities that were instantiated using new keyword and calling ElggEntity::save()
리턴 integer | false

rowToElggStar() 공개 메소드

Handles loading all tables into the correct class.
또한 보기: get_entity_as_row()
또한 보기: add_subtype()
또한 보기: get_entity()
public rowToElggStar ( stdClas\stdClass $row ) : ElggEntit\ElggEntity | false
$row stdClas\stdClass The row of the entry in the entities table.
리턴 ElggEntit\ElggEntity | false

updateLastAction() 공개 메소드

Update the last_action column in the entities table for $guid.
public updateLastAction ( ElggEntit\ElggEntity $entity, integer $posted = null ) : integer | false
$entity ElggEntit\ElggEntity Entity annotation|relationship action carried out on
$posted integer Timestamp of last action
리턴 integer | false

updateRow() 공개 메소드

Update entity table row
public updateRow ( integer $guid, stdClas\stdClass $row ) : integer | false
$guid integer Entity guid
$row stdClas\stdClass Updated data
리턴 integer | false

프로퍼티 상세

$config 보호되어 있는 프로퍼티

protected Config,Elgg $config
리턴 Elgg\Config

$db 보호되어 있는 프로퍼티

protected Database,Elgg $db
리턴 Elgg\Database

$entity_cache 보호되어 있는 프로퍼티

protected EntityCache,Elgg\Cache $entity_cache
리턴 Elgg\Cache\EntityCache

$entity_preloader 보호되어 있는 프로퍼티

protected EntityPreloader,Elgg $entity_preloader
리턴 Elgg\EntityPreloader

$events 보호되어 있는 프로퍼티

protected EventsService,Elgg $events
리턴 Elgg\EventsService

$logger 보호되어 있는 프로퍼티

protected Logger,Elgg $logger
리턴 Elgg\Logger

$metadata_cache 보호되어 있는 프로퍼티

protected MetadataCache,Elgg\Cache $metadata_cache
리턴 Elgg\Cache\MetadataCache

$session 보호되어 있는 프로퍼티

protected ElggSession,ElggSessio $session
리턴 ElggSessio\ElggSession

$subtype_table 보호되어 있는 프로퍼티

protected SubtypeTable,Elgg\Database $subtype_table
리턴 SubtypeTable

$table 보호되어 있는 프로퍼티

protected string $table
리턴 string

$translator 보호되어 있는 프로퍼티

protected Translator,Elgg\I18n $translator
리턴 Elgg\I18n\Translator