{
    "name": "fetchAll",
    "parent": "",
    "title": "",
    "permname": "",
    "modOrder": "001",
    "items": [
        {
            "name": "fetchAll",
            "purpose": " fetches all results as an array,",
            "stype": "function",
            "|xns": "Roo.doc",
            "xtype": "Entry",
            "items": [
                {
                    "name": "fetchAll",
                    "is_static": false,
                    "is_constructor": false,
                    "memberof": "PDO_DataObject",
                    "returndesc": "format dependant on arguments",
                    "returntype": "array",
                    "|xns": "Roo.doc",
                    "xtype": "Synopsis",
                    "items": [
                        {
                            "desc": "key  or closure for something to call on every object",
                            "is_optional": false,
                            "name": "$k",
                            "type": "Closure",
                            "|xns": "Roo.doc",
                            "xtype": "Param"
                        },
                        {
                            "desc": "value",
                            "is_optional": false,
                            "name": "$v",
                            "type": "FETCH_OBJECT",
                            "|xns": "Roo.doc",
                            "xtype": "Param"
                        },
                        {
                            "desc": "method to call on each result to get array value (eg. 'toArray')",
                            "is_optional": false,
                            "name": "$method",
                            "type": "",
                            "|xns": "Roo.doc",
                            "xtype": "Param"
                        },
                        {
                            "desc": "...   other arguments are passed to 'method'",
                            "is_optional": false,
                            "name": "",
                            "type": "mixed",
                            "|xns": "Roo.doc",
                            "xtype": "Param"
                        }
                    ]
                },
                {
                    "stype": "desc",
                    "|xns": "Roo.doc",
                    "xtype": "Section",
                    "items": [
                        {
                            "html": " return format is dependant on args.\n\n if selectAdd() has not been called on the object, then it will add the correct columns to the query.\n\n\n A) ONE COLUMN ARRAY - Array of values (eg. a list of 'id')\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1')\n $ar = $x->fetchAll('id');\n\n \/\/ returns array(1,2,3,4,5)\n ```\n\n A1) ONE COLUMN ARRAY - Array of values (using selectAdd) \n ```\n $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1');\n $x->select('distinct(group_id) as group_id');\n $ar = $x->fetchAll('group_id');\n\n \/\/ returns array(1,2,3,4,5)\n ```\n\n B) ONE COLUMN ARRAY - Fetch the first column (1st argument = true)\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->select('id')\n $x->whereAdd('something = 1')\n $ar = $x->fetchAll(PDO_DataObject::FETCH_COL);\n\n \/\/ returns array(1,2,3,4,5)\n ```\n  \n\n C) ASSOCIATIVE ARRAY - A key=>value associative array\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1')\n $ar = $x->fetchAll('id','name');\n\n \/\/ returns array(1=>'fred',2=>'blogs',3=> .......\n ```\n \n C1) ASSOCIATIVE ARRAY - A key=>value associative array based on columns (note should be faster)\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->select('id,name')\n $x->whereAdd('something = 1')\n $ar = $x->fetchAll(PDO_DataObject::FETCH_COL,PDO_DataObject::FETCH_COL);\n\n \/\/ returns array(1=>'fred',2=>'blogs',3=> .......\n ```\n \n D) array of objects -- NO ARGUMENTS\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1');\n $ar = $x->fetchAll();\n ```\n\n F) array of objects -- USING property as key    \n ```\n $x = PDO_DataObject::factory('mytable');\n $ar = $x->fetchAll('email', PDO_DataObject::FETCH_OBJECT);\n\n \/\/  results in  [ { fred@example.com=> {object} }, {brian@example.com=> {object} }, .... ]\n ```\n\n G) array of objects -- USING primary as key\n ```\n $x = PDO_DataObject::factory('mytable');\n $ar = $x->fetchAll(PDO_DataObject::FETCH_PID,  PDO_DataObject::FETCH_OBJECT);\n\n \/\/  results in  [ 23=> {object} }, 24=> {object} }, .... ]\n```\n\n H) interable via closure  (closure is called with a clone as scope?)\n ```\n $x = PDO_DataObject::factory('mytable');\n $ar = $x->fetchAll(function ($obj, $row_id) { $this->snapshot()->set(['xxx' => 2])->update(); } );\n ```\n \n H1) interable via closure  and return associate array\n ```\n $x = PDO_DataObject::factory('mytable');\n $ar = $x->fetchAll('id' , function ($obj, $row_id) { $this->snapshot()->set(['xxx' => 2])->update(); } );\n ```\n\n I) array of associative arrays - No child dataobjects created... fetchAllAssoc()\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1');\n $ar = $x->fetchAll(PDO_DataObject::FETCH_FAST);\n\n \/\/ returns [ [ a=>1 , b=>2 , c=>3 ], [ a=>1 , b=>2 , c=>3 ], .... ]\n ```\n\n J) array of associative arrays call by method...\n ```\n $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1');\n $ar = $x->fetchAll(false,false,'toArray');\n ```\n\n K) associative array of arrays calling to array with false,0\n ```\n * $x = PDO_DataObject::factory('mytable');\n $x->whereAdd('something = 1');\n $ar = $x->fetchAll('id',false,'toArray',false, 0);\n```\n\n\n\n\n \n",
                            "|xns": "Roo.doc",
                            "xtype": "Para"
                        }
                    ]
                },
                {
                    "stype": "parameter",
                    "|xns": "Roo.doc",
                    "xtype": "Section"
                },
                {
                    "stype": "return",
                    "|xns": "Roo.doc",
                    "xtype": "Section"
                }
            ]
        }
    ]
}