/** * 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['GameLink'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['GameLink'][$this->hashCode()] = true; $keys = GameLinkTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getGameId(), $keys[2] => $this->getGameLinkTypeId(), $keys[3] => $this->getValue()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aGame) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'game'; break; case TableMap::TYPE_FIELDNAME: $key = 'game'; break; default: $key = 'Game'; } $result[$key] = $this->aGame->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aGameLinkType) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'gameLinkType'; break; case TableMap::TYPE_FIELDNAME: $key = 'game_link_type'; break; default: $key = 'GameLinkType'; } $result[$key] = $this->aGameLinkType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } 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['RatingHeader'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['RatingHeader'][$this->hashCode()] = true; $keys = RatingHeaderTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getGameId(), $keys[2] => $this->getPlatformId(), $keys[3] => $this->getCreated(), $keys[4] => $this->getUpdated(), $keys[5] => $this->getComments(), $keys[6] => $this->getScore()); $utc = new \DateTimeZone('utc'); if ($result[$keys[3]] instanceof \DateTime) { // When changing timezone we don't want to change existing instances $dateTime = clone $result[$keys[3]]; $result[$keys[3]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z'); } if ($result[$keys[4]] instanceof \DateTime) { // When changing timezone we don't want to change existing instances $dateTime = clone $result[$keys[4]]; $result[$keys[4]] = $dateTime->setTimezone($utc)->format('Y-m-d\\TH:i:s\\Z'); } $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aGame) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'game'; break; case TableMap::TYPE_FIELDNAME: $key = 'game'; break; default: $key = 'Game'; } $result[$key] = $this->aGame->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aPlatform) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'platform'; break; case TableMap::TYPE_FIELDNAME: $key = 'platform'; break; default: $key = 'Platform'; } $result[$key] = $this->aPlatform->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collRatingValues) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'ratingValues'; break; case TableMap::TYPE_FIELDNAME: $key = 'rating_values'; break; default: $key = 'RatingValues'; } $result[$key] = $this->collRatingValues->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['UserReview'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['UserReview'][$this->hashCode()] = true; $keys = UserReviewTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getGameId(), $keys[2] => $this->getPlatformId(), $keys[3] => $this->getUserId(), $keys[4] => $this->getRigId(), $keys[5] => $this->getRatingId(), $keys[6] => $this->getReview(), $keys[7] => $this->getUpvotes(), $keys[8] => $this->getDownvotes()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aGame) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'game'; break; case TableMap::TYPE_FIELDNAME: $key = 'game'; break; default: $key = 'Game'; } $result[$key] = $this->aGame->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aPlatform) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'platform'; break; case TableMap::TYPE_FIELDNAME: $key = 'platform'; break; default: $key = 'Platform'; } $result[$key] = $this->aPlatform->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); } if (null !== $this->aRating) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'rating'; break; case TableMap::TYPE_FIELDNAME: $key = 'rating'; break; default: $key = 'Rating'; } $result[$key] = $this->aRating->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aRig) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'rig'; break; case TableMap::TYPE_FIELDNAME: $key = 'rig'; break; default: $key = 'Rig'; } $result[$key] = $this->aRig->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }