protected function _beforeRepositoryFetch(AnCommandContext $context)
    {
        $query = $context->query;
        //$query->where('@col(comment.id) IS NULL');
        $query->where('IF(@col(target.enabled) IS NULL, 1, @col(target.enabled) <> 0) AND IF(@col(subject.enabled) IS NULL, 1, @col(subject.enabled) <> 0)')
              ->link('target', array('type' => 'weak', 'bind_type' => false));

        //apply the privacy 
        $privtable = $this->getBehavior('com://site/medium.domain.behavior.privatable');

        $query->privacy = pick($query->privacy, new AnConfig());

        //weak link  the stories with object nodes
        //and use the object.access instead of the story access if there are ny
        $query->link('object', array('type' => 'weak', 'bind_type' => false));
        //we are using the object.access as the privacy reference
        $query->privacy->append(array(
             'use_access_column' => '@col(object.access)',
        ));

        $privtable->execute('before.fetch', $context);
    }
protected function _beforeRepositoryFetch(AnCommandContext $context)
    {
        $query = $context->query;
        //$query->where('@col(comment.id) IS NULL');
        $query->where('IF(@col(target.enabled) IS NULL, 1, @col(target.enabled) <> 0) AND IF(@col(subject.enabled) IS NULL, 1, @col(subject.enabled) <> 0)')
              ->link('target', array('type' => 'weak', 'bind_type' => false));

        //apply the privacy 
        $privtable = $this->getBehavior('com://site/medium.domain.behavior.privatable');

        $query->privacy = pick($query->privacy, new AnConfig());

        //weak link  the stories with object nodes
        //and use the object.access instead of the story access if there are ny
        $query->link('object', array('type' => 'weak', 'bind_type' => false));
        //we are using the object.access as the privacy reference
        $query->privacy->append(array(
             'use_access_column' => '@col(object.access)',
        ));

        $privtable->execute('before.fetch', $context);
    }
protected function _beforeRepositoryFetch ( AnCommandContext $ context ) { $ query = $ context -> query ; //$query->where('@col(comment.id) IS NULL'); $ query -> where ( 'IF(@col(target.enabled) IS NULL, 1, @col(target.enabled) <> 0) AND IF(@col(subject.enabled) IS NULL, 1, @col(subject.enabled) <> 0)' ) -> link ( 'target' , array ( 'type' => 'weak' , 'bind_type' => false ) ) ; //apply the privacy  $ privtable = $ this -> getBehavior ( 'com://site/medium.domain.behavior.privatable' ) ; $ query -> privacy = pick ( $ query -> privacy , new AnConfig ( ) ) ; //weak link  the stories with object nodes //and use the object.access instead of the story access if there are ny $ query -> link ( 'object' , array ( 'type' => 'weak' , 'bind_type' => false ) ) ; //we are using the object.access as the privacy reference $ query -> privacy -> append ( array ( 'use_access_column' => '@col(object.access)' , ) ) ; $ privtable -> execute ( 'before.fetch' , $ context ) ; }
Before fetch.

@param AnCommandContext $context
Before fetch .