public function getRelatedNodeIds($ids)
    {
        $cols = array(
                'story_object_id' ,
                'story_subject_id',
                'story_comment_id',
                'story_target_id' ,
                'parent_id',
                'owner_id',
        );

        foreach ($cols as $key => $value) {
            $cols[$key] = $value.' IN ('.implode(',', $ids).')';
        }

        $cols = implode(' OR ', $cols);

        //all the nodes ids that are somehow related to deleted nodes
        //possible objects (comments/stories/medium nodes)
        $nids = $this->getService('repos:base.node')
                    ->getQuery()
                    ->disableChain()
                    ->where($cols)->fetchValues('id');

        if (!empty($nids)) {
            $story_ids = $this->getService('repos:stories.story')->getQuery()->disableChain()->where(array('object.id' => $nids))->fetchValues('id');
            $nids = array_merge($nids, $story_ids);

            //if there are any medium nodes in the related nodes
            //check if they have any comments
            $comment_ids = $this->getService('repos:base.comment')->getQuery()->disableChain()->where(array('parent.id' => $nids))->fetchValues('id');
            $nids = array_merge($nids, $comment_ids);
        }

        return array_unique($nids);
    }
public function getRelatedNodeIds($ids)
    {
        $cols = array(
                'story_object_id' ,
                'story_subject_id',
                'story_comment_id',
                'story_target_id' ,
                'parent_id',
                'owner_id',
        );

        foreach ($cols as $key => $value) {
            $cols[$key] = $value.' IN ('.implode(',', $ids).')';
        }

        $cols = implode(' OR ', $cols);

        //all the nodes ids that are somehow related to deleted nodes
        //possible objects (comments/stories/medium nodes)
        $nids = $this->getService('repos:base.node')
                    ->getQuery()
                    ->disableChain()
                    ->where($cols)->fetchValues('id');

        if (!empty($nids)) {
            $story_ids = $this->getService('repos:stories.story')->getQuery()->disableChain()->where(array('object.id' => $nids))->fetchValues('id');
            $nids = array_merge($nids, $story_ids);

            //if there are any medium nodes in the related nodes
            //check if they have any comments
            $comment_ids = $this->getService('repos:base.comment')->getQuery()->disableChain()->where(array('parent.id' => $nids))->fetchValues('id');
            $nids = array_merge($nids, $comment_ids);
        }

        return array_unique($nids);
    }
public function getRelatedNodeIds ( $ ids ) { $ cols = array ( 'story_object_id' , 'story_subject_id' , 'story_comment_id' , 'story_target_id' , 'parent_id' , 'owner_id' , ) ; foreach ( $ cols as $ key => $ value ) { $ cols [ $ key ] = $ value . ' IN (' . implode ( ',' , $ ids ) . ')' ; } $ cols = implode ( ' OR ' , $ cols ) ; //all the nodes ids that are somehow related to deleted nodes //possible objects (comments/stories/medium nodes) $ nids = $ this -> getService ( 'repos:base.node' ) -> getQuery ( ) -> disableChain ( ) -> where ( $ cols ) -> fetchValues ( 'id' ) ; if ( ! empty ( $ nids ) ) { $ story_ids = $ this -> getService ( 'repos:stories.story' ) -> getQuery ( ) -> disableChain ( ) -> where ( array ( 'object.id' => $ nids ) ) -> fetchValues ( 'id' ) ; $ nids = array_merge ( $ nids , $ story_ids ) ; //if there are any medium nodes in the related nodes //check if they have any comments $ comment_ids = $ this -> getService ( 'repos:base.comment' ) -> getQuery ( ) -> disableChain ( ) -> where ( array ( 'parent.id' => $ nids ) ) -> fetchValues ( 'id' ) ; $ nids = array_merge ( $ nids , $ comment_ids ) ; } return array_unique ( $ nids ) ; }
Get an array of related nodes ids.

@param array $ids An array of ids

@return array
Get an array of related nodes ids .