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_CAMELNAME,
  *                    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->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['User'][$this->hashCode()] = true;
     $keys = UserTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getInstanceName(), $keys[2] => $this->getName());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aInstance) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'instance';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'instance';
                     break;
                 default:
                     $key = 'Instance';
             }
             $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collConnections) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'connections';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'connections';
                     break;
                 default:
                     $key = 'Connections';
             }
             $result[$key] = $this->collConnections->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSubscriptions) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'subscriptions';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'subscriptions';
                     break;
                 default:
                     $key = 'Subscriptions';
             }
             $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
 /**
  * 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_CAMELNAME,
  *                    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['Connection'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Connection'][$this->hashCode()] = true;
     $keys = ConnectionTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getInstanceName(), $keys[2] => $this->getUserId(), $keys[3] => $this->getPeer(), $keys[4] => $this->getStarted(), $keys[5] => $this->getType());
     if ($result[$keys[4]] instanceof \DateTime) {
         $result[$keys[4]] = $result[$keys[4]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aInstance) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'instance';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'instance';
                     break;
                 default:
                     $key = 'Instance';
             }
             $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'user';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'user';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Ejemplo n.º 3
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_CAMELNAME,
  *                    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['Input'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Input'][$this->hashCode()] = true;
     $keys = InputTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getUuid(), $keys[1] => $this->getInstanceName(), $keys[2] => $this->getStarted(), $keys[3] => $this->getInput(), $keys[4] => $this->getNetwork(), $keys[5] => $this->getMux(), $keys[6] => $this->getWeight());
     if ($result[$keys[2]] instanceof \DateTime) {
         $result[$keys[2]] = $result[$keys[2]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aInstance) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'instance';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'instance';
                     break;
                 default:
                     $key = 'Instance';
             }
             $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collInputErrors) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'inputErrors';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'input_errors';
                     break;
                 default:
                     $key = 'InputErrors';
             }
             $result[$key] = $this->collInputErrors->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSubscriptions) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'subscriptions';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'subscriptions';
                     break;
                 default:
                     $key = 'Subscriptions';
             }
             $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }