/**
  * 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['PermissionGroupUser'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['PermissionGroupUser'][$this->hashCode()] = true;
     $keys = PermissionGroupUserTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getUserId(), $keys[1] => $this->getGroupId());
     $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 = 'user';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aPermissionGroup) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'permissionGroup';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'permission_group';
                     break;
                 default:
                     $key = 'PermissionGroup';
             }
             $result[$key] = $this->aPermissionGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #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['Artist'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Artist'][$this->hashCode()] = true;
     $keys = ArtistTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getUserId(), $keys[3] => $this->getForbidden());
     $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 = 'user';
                     break;
                 default:
                     $key = 'User';
             }
             $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collArtistLyrics) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'artistLyrics';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'artist_lyrics';
                     break;
                 default:
                     $key = 'ArtistLyrics';
             }
             $result[$key] = $this->collArtistLyrics->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
Example #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['Lyric'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Lyric'][$this->hashCode()] = true;
     $keys = LyricTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getTitle(), $keys[2] => $this->getText(), $keys[3] => $this->gettextBg(), $keys[4] => $this->gettextBgAdded(), $keys[5] => $this->getextraInfo(), $keys[6] => $this->getsendBy(), $keys[7] => $this->getcacheTitleShort(), $keys[8] => $this->getViews(), $keys[9] => $this->getPopularity(), $keys[10] => $this->getvotesCount(), $keys[11] => $this->getvideoYoutube(), $keys[12] => $this->getvideoVbox7(), $keys[13] => $this->getvideoMetacafe(), $keys[14] => $this->getdownload());
     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->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);
         }
         if (null !== $this->collArtistLyrics) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'artistLyrics';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'artist_lyrics';
                     break;
                 default:
                     $key = 'ArtistLyrics';
             }
             $result[$key] = $this->collArtistLyrics->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLyricLanguages) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'lyricLanguages';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'lyric_languages';
                     break;
                 default:
                     $key = 'LyricLanguages';
             }
             $result[$key] = $this->collLyricLanguages->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLyricTranslations) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'lyricTranslations';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'lyric_translations';
                     break;
                 default:
                     $key = 'LyricTranslations';
             }
             $result[$key] = $this->collLyricTranslations->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLyricVotes) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'lyricVotes';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'lyric_votes';
                     break;
                 default:
                     $key = 'LyricVotes';
             }
             $result[$key] = $this->collLyricVotes->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }