src/Charcoal/Admin/Service/Exporter.php
private function rows()
    {
        $collection = $this->collection();
        $properties = $this->properties();
        $metadata = $this->metadata();

        foreach ($collection as $c) {
            $row = [];
            foreach ($properties as $p) {
                // Use the property factory to get
                // the proper val to output in csv
                // as a string.
                $propertyMetadata = $metadata->get('properties.'.$p);
                $prop = $this->propertyFactory()->create($propertyMetadata['type']);
                $prop->setIdent($p);
                $prop->setData($propertyMetadata);
                $row[] = $this->stripContent($prop->displayVal($c->propertyValue($p)));
            }
            yield $row;
        }
    }
private function rows()
    {
        $collection = $this->collection();
        $properties = $this->properties();
        $metadata = $this->metadata();

        foreach ($collection as $c) {
            $row = [];
            foreach ($properties as $p) {
                // Use the property factory to get
                // the proper val to output in csv
                // as a string.
                $propertyMetadata = $metadata->get('properties.'.$p);
                $prop = $this->propertyFactory()->create($propertyMetadata['type']);
                $prop->setIdent($p);
                $prop->setData($propertyMetadata);
                $row[] = $this->stripContent($prop->displayVal($c->propertyValue($p)));
            }
            yield $row;
        }
    }
private function rows ( ) { $ collection = $ this -> collection ( ) ; $ properties = $ this -> properties ( ) ; $ metadata = $ this -> metadata ( ) ; foreach ( $ collection as $ c ) { $ row = [ ] ; foreach ( $ properties as $ p ) { // Use the property factory to get // the proper val to output in csv // as a string. $ propertyMetadata = $ metadata -> get ( 'properties.' . $ p ) ; $ prop = $ this -> propertyFactory ( ) -> create ( $ propertyMetadata [ 'type' ] ) ; $ prop -> setIdent ( $ p ) ; $ prop -> setData ( $ propertyMetadata ) ; $ row [ ] = $ this -> stripContent ( $ prop -> displayVal ( $ c -> propertyValue ( $ p ) ) ) ; } yield $ row ; } }
CSV rows from collection
@return array Rows with data from collection.
CSV rows from collection