Exemplo 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->getIdMember(), $keys[2] => $this->getUsername(), $keys[3] => $this->getMemberFrom(), $keys[4] => $this->getUrl(), $keys[5] => $this->getEmail(), $keys[6] => $this->getEmailConfirmedAt(), $keys[7] => $this->getEmailConfirmToken(), $keys[8] => $this->getEmailChangeToken(), $keys[9] => $this->getPassword(), $keys[10] => $this->getPasswordResetToken(), $keys[11] => $this->getPermissions(), $keys[12] => $this->getSigninCount(), $keys[13] => $this->getIdImage(), $keys[14] => $this->getLastSigninAt(), $keys[15] => $this->getCreatedAt(), $keys[16] => $this->getUpdatedAt());
     if ($result[$keys[3]] instanceof \DateTime) {
         $result[$keys[3]] = $result[$keys[3]]->format('c');
     }
     if ($result[$keys[6]] instanceof \DateTime) {
         $result[$keys[6]] = $result[$keys[6]]->format('c');
     }
     if ($result[$keys[14]] instanceof \DateTime) {
         $result[$keys[14]] = $result[$keys[14]]->format('c');
     }
     if ($result[$keys[15]] instanceof \DateTime) {
         $result[$keys[15]] = $result[$keys[15]]->format('c');
     }
     if ($result[$keys[16]] instanceof \DateTime) {
         $result[$keys[16]] = $result[$keys[16]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aImage) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'image';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'images';
                     break;
                 default:
                     $key = 'Image';
             }
             $result[$key] = $this->aImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aMember) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'member';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'members';
                     break;
                 default:
                     $key = 'Member';
             }
             $result[$key] = $this->aMember->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collArticles) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'articles';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'articless';
                     break;
                 default:
                     $key = 'Articles';
             }
             $result[$key] = $this->collArticles->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collComments) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'comments';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'commentss';
                     break;
                 default:
                     $key = 'Comments';
             }
             $result[$key] = $this->collComments->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collRatings) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'ratings';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'ratingss';
                     break;
                 default:
                     $key = 'Ratings';
             }
             $result[$key] = $this->collRatings->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collUserReportsRelatedByIdUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'userReports';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'user_reportss';
                     break;
                 default:
                     $key = 'UserReports';
             }
             $result[$key] = $this->collUserReportsRelatedByIdUser->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collUserReportsRelatedByIdUserReported) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'userReports';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'user_reportss';
                     break;
                 default:
                     $key = 'UserReports';
             }
             $result[$key] = $this->collUserReportsRelatedByIdUserReported->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collBugReports) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'bugReports';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'bug_reportss';
                     break;
                 default:
                     $key = 'BugReports';
             }
             $result[$key] = $this->collBugReports->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collIdeasRelatedByIdUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'ideas';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'ideass';
                     break;
                 default:
                     $key = 'Ideas';
             }
             $result[$key] = $this->collIdeasRelatedByIdUser->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collIdeasRelatedByApprovedBy) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'ideas';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'ideass';
                     break;
                 default:
                     $key = 'Ideas';
             }
             $result[$key] = $this->collIdeasRelatedByApprovedBy->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collMembershipApplications) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'membershipApplications';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'membership_applicationss';
                     break;
                 default:
                     $key = 'MembershipApplications';
             }
             $result[$key] = $this->collMembershipApplications->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collGalleries) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'galleries';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'galleriess';
                     break;
                 default:
                     $key = 'Galleries';
             }
             $result[$key] = $this->collGalleries->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collBansRelatedByIdUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'bans';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'banss';
                     break;
                 default:
                     $key = 'Bans';
             }
             $result[$key] = $this->collBansRelatedByIdUser->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collBansRelatedByBannedBy) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'bans';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'banss';
                     break;
                 default:
                     $key = 'Bans';
             }
             $result[$key] = $this->collBansRelatedByBannedBy->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
Exemplo 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_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['Article'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Article'][$this->hashCode()] = true;
     $keys = ArticleTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getIdUser(), $keys[2] => $this->getIdImage(), $keys[3] => $this->getIdCategory(), $keys[4] => $this->getTitle(), $keys[5] => $this->getUrl(), $keys[6] => $this->getKeywords(), $keys[7] => $this->getContent(), $keys[8] => $this->getCreatedAt(), $keys[9] => $this->getUpdatedAt());
     if ($result[$keys[8]] instanceof \DateTime) {
         $result[$keys[8]] = $result[$keys[8]]->format('c');
     }
     if ($result[$keys[9]] instanceof \DateTime) {
         $result[$keys[9]] = $result[$keys[9]]->format('c');
     }
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'user';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'users';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aImage) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'image';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'images';
                     break;
                 default:
                     $key = 'Image';
             }
             $result[$key] = $this->aImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aCategory) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'category';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'categories';
                     break;
                 default:
                     $key = 'Category';
             }
             $result[$key] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collComments) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'comments';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'commentss';
                     break;
                 default:
                     $key = 'Comments';
             }
             $result[$key] = $this->collComments->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }