Exemplo n.º 1
0
 /**
  * generate entity
  * 
  */
 public function execute()
 {
     // connect to salesforce
     $client = Srecord_Schema::getClient();
     // get object definition
     $objectTypes = array();
     $global = $client->describeGlobal();
     foreach ($global->sobjects as $def) {
         $objectTypes[] = $def->name;
     }
     $objectDefs = array();
     $offset = 0;
     $length = 100;
     $max = count($objectTypes);
     while ($offset < $max) {
         $part = $client->describeSObjects(array_slice($objectTypes, $offset, $length));
         foreach ($part as $one) {
             // TODO arrayの+でうまくいかなかった。。
             $objectDefs[] = $one;
         }
         $offset += $length;
     }
     // generate class file
     foreach ($objectDefs as $def) {
         $this->manipMeta($def);
         $this->generate($def);
     }
 }
Exemplo n.º 2
0
 /**
  * undelete record of specified id.
  * Id must be set as a parameter or Id field.
  * if you want to undelete multiple records, use Srecord_Schema::undeleteAll() instead.
  * 
  * @param string $id
  * @return bool
  */
 public function undelete($id = NULL)
 {
     if ($id == NULL) {
         $id = $this->Id;
     }
     if ($this->_null($id) == NULL) {
         throw new SRecord_ActiveRecordException('Id is not specified.');
     }
     // connect to salesforce.
     $client = Srecord_Schema::getClient();
     $res = $client->undelete(array($id));
     if ($res->success == 1) {
         $this->_state = self::STATE_SUCCESS;
         $this->_errors = NULL;
         return TRUE;
     }
     // error.
     $this->_state = self::STATE_FAIL;
     $this->_errors = $res->errors;
     return FALSE;
 }