Doctrine 2 Expanding the Tree: Closing the Table

I am using the Tree - Nestedset behavior extension for the Doctrine 2 strategy and Closure Table. On my website, users can create folders and subfolders and view them. I implemented this using the Closure Table strategy and create folders using the childrenHierarchy () method :

       $directoryTree = $repository->childrenHierarchy(
            null,  
            true,  
            array(
        'decorate' => false,
        'childSort' => array('field' => 'directory_name', 'dir' => 'asc')
    ));

It works fine, but returns all folders for all users, and I don’t know how to determine user_id in this case, so that only folders belonging to the user are displayed. Is there any way to do this?

I will be happy for your answers.

+4
source share
1 answer

From doc :

childrenHierarchy: , . : node: a node, . "null" ( , ).

:

// example, 
$loggedInUserFolder = SOME_METHOD_RETURNS_USER_FOLDER($this->getUser());
$directoryTree = $repository->childrenHierarchy(
            $loggedInUserFolder,  
            true,  
            array(
        'decorate' => false,
        'childSort' => array('field' => 'directory_name', 'dir' => 'asc')
    ));
+3

All Articles