0

My code is:

 $costSheetQuery = $this->CostSheets->find('all')->where(['id IN' => $criteria]);;
$costSheetData = $costSheetQuery->all();

I print the array $costSheetData and it gives me the following relust:

Cake\ORM\ResultSet Object
(
    [items] => Array
        (
            [0] => App\Model\Entity\CostSheet Object
                (
                    [id] => 5
                    [key_value] => {"sample_date":"10-03-2018","mh_sc":"mh-sc","buyer":"buyer","season":"season","style":"styel","style_detail":"Style Details","sample_img":[[""]],"fab_category":[["FABRIC CATEGORY","FABRIC CATEGORY","FABRIC CATEGORY","FABRIC CATEGORY","FABRIC CATEGORY","FABRIC CATEGORY"]],"patt":[["PATT","PATT","PATT","PATT","PATT","PATT"]],"size":[["SIZE","SIZE","SIZE","SIZE","SIZE","SIZE"]],"ship_date":[[{"year":"2018"},{"month":"01"},{"day":"01"}]],"piece":[["10","20","30","40","50","60"]],"fabric_usage":[["USAGE"]],"fabric_yds":[["yds"]],"fabric_body":[["Body","Body","Body","Body","Body","Body"]],"cm":[["embrotery"]],"cm_value":[["     10     ","12.00","","15","",""]],"trims":[["thread"]],"trims_value":[["10","","10","20","",""]]}
                    [created] => Cake\I18n\FrozenTime Object
                        (
                            [time] => 2018-03-10T16:47:52+00:00
                            [timezone] => UTC
                            [fixedNowTime] => 
                        )

                    [modified] => Cake\I18n\FrozenTime Object
                        (
                            [time] => 2018-03-10T16:47:52+00:00
                            [timezone] => UTC
                            [fixedNowTime] => 
                        )

                    [[new]] => 
                    [[accessible]] => Array
                        (
                            [key_value] => 1
                            [created] => 1
                            [modified] => 1
                        )

                    [[dirty]] => Array
                        (
                        )

                    [[original]] => Array
                        (
                        )

                    [[virtual]] => Array
                        (
                        )

                    [[errors]] => Array
                        (
                        )

                    [[invalid]] => Array
                        (
                        )

                    [[repository]] => CostSheets
                )

        )

)

Whats hell is going on. I just start hating cakephp. My additional bullshit in my array? I also try to separate as : $items->costSheetData as item is an object of $costSheetData. But it gives me an arrow. Any idea?

Narendra
  • 1,511
  • 1
  • 10
  • 20
Abdus Sattar Bhuiyan
  • 3,016
  • 4
  • 38
  • 72
  • it's default behavior of cakephp. [this](https://stackoverflow.com/questions/47865478/can-we-add-custom-values-to-a-cakephp-table-object) may help – Minar Mnr Apr 12 '18 at 06:03
  • You asked for all such records, it gave you a list. You should be able to do `foreach ($costSheetData as $item)` to access the individual `costSheet`s. What's the problem here? And what does "gives me an arrow" mean? – Greg Schmidt Apr 12 '18 at 20:56
  • If you don't like the fact that it's in a ResultSet, use `toArray` instead of `all`. – Greg Schmidt Apr 12 '18 at 21:03

0 Answers0