Sets the enity data after it has been fetched from the database storage.

@param AnCommandContext $context Context
339842
protected function _afterEntityFetch(AnCommandContext $context)
    {
        //set the persistd flag
        $this->setPersisted(true);

        //set the raw data
        $this->_data->setRowData($context['data']);

        //force setting the keys
        foreach ($context['keys'] as $key => $value) {
            $this->_data[$key] = $value;
        }
    }
131678
protected function _afterRead(KControllerContextInterface $context)
    {
        if(!empty($this->_output)) {
            $context->result = $this->_output;
        }
    }
179037
protected static function cache_add(context $context) {
        if (isset(self::$cache_contextsbyid[$context->id])) {
            // already cached, no need to do anything - this is relatively cheap, we do all this because count() is slow
            return;
        }

        if (self::$cache_count >= CONTEXT_CACHE_MAX_SIZE) {
            $i = 0;
            foreach(self::$cache_contextsbyid as $ctx) {
                $i++;
                if ($i <= 100) {
                    // we want to keep the first contexts to be loaded on this page, hopefully they will be needed again later
                    continue;
                }
                if ($i > (CONTEXT_CACHE_MAX_SIZE / 3)) {
                    // we remove oldest third of the contexts to make room for more contexts
                    break;
                }
                unset(self::$cache_contextsbyid[$ctx->id]);
                unset(self::$cache_contexts[$ctx->contextlevel][$ctx->instanceid]);
                self::$cache_count--;
            }
        }

        self::$cache_contexts[$context->contextlevel][$context->instanceid] = $context;
        self::$cache_contextsbyid[$context->id] = $context;
        self::$cache_count++;
    }
492008
public function initializeContext(Context $context)
    {
        if (!$context instanceof CollectionAwareContextInterface) {
            return;
        }
        $context->setTerminalCollection($this->collection);
        $context->setTerminalDefaultAlias($this->defaultAlias);
    }
867049
public function initializeContext(Context $context)
    {
        if (!$context instanceof GuzzleAwareContext) {
            return;
        }

        $context->setGuzzleClient($this->client);
        $context->setGuzzleParameters($this->parameters);
    }
706571
protected function _beforeEntityUpdate(AnCommandContext $context)
    {
        $modifications = $this->getModifiedData();

        if (isset($this->__restored)) {
            return;
        }

        if (
              $modifications->name ||
              $modifications->body ||
              $modifications->excerpt
        ) {
            $revision = $this->addNewRevision();

            foreach ($modifications as $property => $change) {
                $revision->$property = $change->old;
            }
        }
    }
1269657
protected function _afterEntityInsert(AnCommandContext $context)
    {
        $this->subscribee->getRepository()
                         ->getBehavior('subscribable')
                         ->resetStats(array($this->subscribee));
    }
1332406
protected function setContext(MigrationContext $context)
	{
		$this->_context = $context;
		$this->_context->setContainer($this->_container);
	}
879769
protected function _beforeRepositoryFetch(AnCommandContext $context)
    {
        if (!get_viewer()->admin()) {
            $query = $context->query;
            $query->where('IF(@col(enabled)=FALSE,0,1)');
        }
    }
595706
protected function _afterRender(TemplateContextInterface $context)
    {
        if(is_string($context->result))
        {
            $content = $context->result;

            foreach($this->__filter_queue as $filter) {
                $filter->filter($content, $this->getMixer());
            }

            $context->result = $content;
        }
    }
663562
protected function _actionSetPrivacy(AnCommandContext $context)
    {
        if ($this->hasBehavior('privatable')) {
            $this->getBehavior('privatable')->execute('action.setprivacy', $context);
        }

        $data = $context->data;

        if ($data->access != 'followers') {
            $data->allowFollowRequest = false;
        }

        $this->getItem()->allowFollowRequest = (bool) $data->allowFollowRequest;
    }
934408
protected function _afterEntityDelete(AnCommandContext $context)
    {
        $this->subscribee->getRepository()
                         ->getBehavior('subscribable')
                         ->resetStats(array($this->subscribee));
    }
350795
public function setEndDate(AnCommandContext $context)
    {
        $data = $context->data;

        if ($data->day || $data->month || $data->year) {
            $date = new AnDate();
            $date->day((int) $data->day);
            $date->month((int) $data->month);
            $date->year((int) $data->year);
            $data->endDate = $date;
        }
    }
795584
public function setReferenceContext(ReferenceContext $context)
    {
        foreach ($this->_properties as $property => $value) {
            if ($value instanceof Reference) {
                $value->setContext($context);
            } elseif ($value instanceof SpecObjectInterface) {
                $value->setReferenceContext($context);
            } elseif (is_array($value)) {
                foreach ($value as $k => $item) {
                    if ($item instanceof Reference) {
                        $item->setContext($context);
                    } elseif ($item instanceof SpecObjectInterface) {
                        $item->setReferenceContext($context);
                    }
                }
            }
        }
    }
1155657
protected function _beforeUpdate(DatabaseContext $context)
    {
        //Get the modified columns
        $modified  = $this->getTable()->filter($this->getProperties(true));

        if(!empty($modified)) {
            $this->_beforeInsert($context);
        }
    }
1133109
public function fetchEntity(AnCommandContext $context)
    {
        if (!$this->_entity) {
            $this->_entity = $this->getService('com:settings.domain.entity.setting')->load();
        }

        return $this->_entity;
    }
516992
protected function _afterEntityInsert(AnCommandContext $context)
    {
        $this->parent->getRepository()
                     ->getBehavior('commentable')
                     ->resetStats(array($this->parent));
        $this->parent->execute('after.comment', array('comment' => $this));
    }