kavykav 0 Newbie Poster
<?php


class Application_Model_YearBook_Mapper {

    protected $appId = "assOvWMver34QkcaaNYdUc";
    protected $collectionId = "chDkpaVkWr36J-caaNYdUc";

    public function add($course, $year, $userId) {
        $body = "$course#$year#$userId";
        $entryMapper = new Application_Model_Appdata_Collection_Entry($data);
        $data = array("content_type" => "text/plain", "body" => $body);
        $entry = $entryMapper->create($this->appId, $this->collectionId, $data);
    }

    public function fetchAll() {
        $collectionMapper = new Application_Model_Appdata_Collection_Mapper();
        $collection = $collectionMapper->fetch($this->appId, $this->collectionId);
        $entry = $collection->getEntry();
        $allYearbook = array();
        foreach ($entry as $k => $v) {
            $body = $v->getValue();
            $data = $this->utility($body);
            $allYearbook = new Application_Model_YearBook($data);
        }
        return $allYearbook;
    }

    public function utility($body) {
        //returns an array ["course"=>"the course","year"=>"the year","userid"=>"the id"];
    }

}

?>

problem is the function utility how do i convert body into an array that has course,year and userid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.