Exemple #1
0
 /**
  * Retrieves the data for the node $node from the data store and assigns it
  * to the node's 'data' property.
  *
  * @param ezcTreeNode $node
  */
 public function fetchDataForNode(ezcTreeNode $node)
 {
     $id = $node->id;
     $elem = $this->dom->getElementById("{$node->tree->prefix}{$id}");
     $dataElem = $elem->getElementsByTagNameNS('http://components.ez.no/Tree/data', 'data')->item(0);
     if ($dataElem === null || (string) $dataElem->parentNode->getAttribute('id') !== "{$node->tree->prefix}{$id}") {
         throw new ezcTreeDataStoreMissingDataException($node->id);
     }
     $node->injectData($dataElem->firstChild->data);
     $node->dataFetched = true;
 }
 /**
  * Retrieves the data for the node $node from the data store and assigns it
  * to the node's 'data' property.
  *
  * @param ezcTreeNode $node
  */
 public function fetchDataForNode(ezcTreeNode $node)
 {
     $db = $this->dbHandler;
     $q = $db->createSelectQuery();
     $id = $node->id;
     $q->select('*')->from($db->quoteIdentifier($this->table))->where($q->expr->eq($db->quoteIdentifier($this->idField), $q->bindValue($id)));
     $s = $q->prepare();
     $s->execute();
     $result = $s->fetch(PDO::FETCH_ASSOC);
     if (!$result) {
         throw new ezcTreeDataStoreMissingDataException($node->id);
     }
     $node->injectData($this->filterDataFromResult($result));
     $node->dataFetched = true;
 }