當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Node::toArray方法代碼示例

本文整理匯總了PHP中Node::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Node::toArray方法的具體用法?PHP Node::toArray怎麽用?PHP Node::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Node的用法示例。


在下文中一共展示了Node::toArray方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: transformData

 /**
  * Transform the \Node entity.
  *
  * @param \Node $model
  *
  * @return array
  */
 public function transformData($model)
 {
     return $model->toArray();
 }
開發者ID:royalwang,項目名稱:phphub-server,代碼行數:11,代碼來源:NodeTransformer.php

示例2: transformData

 /**
  * Transform the \Node entity.
  *
  * @param \Node $model
  *
  * @return array
  */
 public function transformData($model)
 {
     $data = $model->toArray();
     $data['parent_node'] = $model->parent_node ?: 0;
     return $data;
 }
開發者ID:adminrt,項目名稱:phphub-server,代碼行數:13,代碼來源:NodeTransformer.php

示例3: nodeToPersistentArray

 public function nodeToPersistentArray(Node $obj)
 {
     $persistent = array_intersect_key($obj->toArray(), array_flip($this->NodeDBMeta->getPersistentFields()));
     $persistent['ElementID'] = $obj->getNodeRef()->getElement()->getElementID();
     return $persistent;
 }
開發者ID:wb-crowdfusion,項目名稱:crowdfusion,代碼行數:6,代碼來源:NodeMapper.php

示例4: json_encode

<?php

require_once 'Node.php';
$nodes = array();
$node = new Node("Titutlo A1", "A1", true, true, true, array(new Node("Titutlo A1.B1", "A1.B1", true, true, true), new Node("Titutlo A1.B2", "A1.B2", true, true, true, array(new Node("Titutlo A1.B2.C1", "A1.B2.C1", true, true, true)))));
$node2 = new Node("Titutlo A2", "A2", true, true, true, array(new Node("Titutlo A2.B1", "A2.B1", true, true, true, array(new Node("Titutlo A2.B1.C1", "A2.B1.C1"), new Node("Titutlo A2.B1.C2", "A2.B1.C2"), new Node("Titutlo A2.B1.C3", "A2.B1.C3")))));
$node3 = new Node("Titutlo A3", "A3");
array_push($nodes, $node->toArray());
array_push($nodes, $node2->toArray());
array_push($nodes, $node3->toArray());
echo json_encode($nodes);
開發者ID:rafaelllins,項目名稱:ytJsComponents,代碼行數:11,代碼來源:ajax-tree-sample.php

示例5: function

        $pass = false;
        echo "Must return false\n";
    }
    // Print
    $root->print_r();
    return $pass;
};
$tests['fromArray toArray'] = function () {
    $pass = true;
    // Prepare
    $json = '{"id":"c170ad596fb6f987f0b34bf58099ca63","properties":[],"children":{"a":{"id":"2d63f222710222663373b0692b273103","properties":[],"children":{"b":{"id":"dc3a2e4652f068bad6f78e71920483f8","properties":[],"children":{"c":{"id":"63f5f8032383f518381541e2053b9213","properties":[],"children":[]},"d":{"id":"1f3b9cf313b126f9ed03739730d58eed","properties":[],"children":[]}}},"e":{"id":"5049e43d9fd9576aa0e715d9bd8dea20","properties":[],"children":{"f":{"id":"f8a45a93ed68521a7d4c23b7918b13b3","properties":[],"children":[]},"g":{"id":"a95c67d9ebdbc4f3fb175242fb1307eb","properties":[],"children":[]}}}}}}}';
    $array = json_decode($json, true);
    // Run
    $root = new Node();
    $root->fromArray($array);
    $result = $root->toArray();
    $result_json = json_encode($result);
    // Check
    if ($json !== $result_json) {
        $pass = false;
        echo "Serialization fail\n";
    }
    // Print
    echo "{$json}\n{$result_json}";
    return $pass;
};
$tests['get property'] = function () {
    $pass = true;
    // Prepare
    $hash_red = md5(microtime());
    $hash_blue = md5(microtime());
開發者ID:fulldump,項目名稱:8,代碼行數:31,代碼來源:Node.test.php

示例6: getThePropertiesAsAnArray

 /**
  * @test
  */
 public function getThePropertiesAsAnArray()
 {
     $properties = array('id' => 'xyz', 'foo' => 'bar', 'gggg' => 123);
     $node = new Node($properties);
     $this->assertEquals($properties, $node->toArray());
 }
開發者ID:bluem,項目名稱:tree,代碼行數:9,代碼來源:NodeTest.php


注:本文中的Node::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。