ElggData::initializeAttributes PHP Method

initializeAttributes() protected method

This is vital to distinguish between metadata and base parameters.
protected initializeAttributes ( ) : void
return void
    protected function initializeAttributes()
    {
        // Create attributes array if not already created
        if (!is_array($this->attributes)) {
            $this->attributes = array();
        }
        $this->attributes['time_created'] = null;
    }

Usage Example

Beispiel #1
0
 /**
  * Initialize the attributes array.
  *
  * This is vital to distinguish between metadata and base parameters.
  *
  * @return void
  */
 protected function initializeAttributes()
 {
     parent::initializeAttributes();
     $this->attributes['guid'] = NULL;
     $this->attributes['type'] = NULL;
     $this->attributes['subtype'] = NULL;
     $this->attributes['owner_guid'] = elgg_get_logged_in_user_guid();
     $this->attributes['container_guid'] = elgg_get_logged_in_user_guid();
     $this->attributes['site_guid'] = NULL;
     $this->attributes['access_id'] = ACCESS_PRIVATE;
     $this->attributes['time_created'] = NULL;
     $this->attributes['time_updated'] = NULL;
     $this->attributes['last_action'] = NULL;
     $this->attributes['enabled'] = "yes";
     // There now follows a bit of a hack
     /* Problem: To speed things up, some objects are split over several tables,
      * this means that it requires n number of database reads to fully populate
      * an entity. This causes problems for caching and create events
      * since it is not possible to tell whether a subclassed entity is complete.
      *
      * Solution: We have two counters, one 'tables_split' which tells whatever is
      * interested how many tables are going to need to be searched in order to fully
      * populate this object, and 'tables_loaded' which is how many have been
      * loaded thus far.
      *
      * If the two are the same then this object is complete.
      *
      * Use: isFullyLoaded() to check
      */
     $this->attributes['tables_split'] = 1;
     $this->attributes['tables_loaded'] = 0;
 }
All Usage Examples Of ElggData::initializeAttributes