Ejemplo n.º 1
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
  *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
  *                    Defaults to TableMap::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['User'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['User'][$this->getPrimaryKey()] = true;
     $keys = UserTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getUser(), $keys[2] => $this->getPassword(), $keys[3] => $this->getRoleId(), $keys[4] => $this->getStatus());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aRole) {
             $result['Role'] = $this->aRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collNotifications) {
             $result['Notifications'] = $this->collNotifications->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->singleDetail) {
             $result['Detail'] = $this->singleDetail->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
  *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
  *                    Defaults to TableMap::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['RolePermission'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['RolePermission'][$this->getPrimaryKey()] = true;
     $keys = RolePermissionTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getPayCredit(), $keys[2] => $this->getReadCredit(), $keys[3] => $this->getPayDebit(), $keys[4] => $this->getReadDebit(), $keys[5] => $this->getCreateProduct(), $keys[6] => $this->getReadProduct(), $keys[7] => $this->getUpdateProduct(), $keys[8] => $this->getDestroyProduct(), $keys[9] => $this->getCreatePurchase(), $keys[10] => $this->getReadPurchase(), $keys[11] => $this->getUpdatePurchase(), $keys[12] => $this->getDestroyPurchase(), $keys[13] => $this->getCreateRole(), $keys[14] => $this->getReadRole(), $keys[15] => $this->getUpdateRole(), $keys[16] => $this->getDestroyRole(), $keys[17] => $this->getCreateSales(), $keys[18] => $this->getReadSales(), $keys[19] => $this->getUpdateSales(), $keys[20] => $this->getDestroySales(), $keys[21] => $this->getCreateSecondParty(), $keys[22] => $this->getReadSecondParty(), $keys[23] => $this->getUpdateSecondParty(), $keys[24] => $this->getDestroySecondParty(), $keys[25] => $this->getCreateStock(), $keys[26] => $this->getReadStock(), $keys[27] => $this->getUpdateStock(), $keys[28] => $this->getDestroyStock(), $keys[29] => $this->getCreateUnit(), $keys[30] => $this->getReadUnit(), $keys[31] => $this->getUpdateUnit(), $keys[32] => $this->getDestroyUnit(), $keys[33] => $this->getCreateUser(), $keys[34] => $this->getReadUser(), $keys[35] => $this->getUpdateUser(), $keys[36] => $this->getDestroyUser(), $keys[37] => $this->getResetPassUser());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aRole) {
             $result['Role'] = $this->aRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }