/** * 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['PromotionTypeI18n'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['PromotionTypeI18n'][$this->hashCode()] = true; $keys = PromotionTypeI18nTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getPromotionTypeId(), $keys[1] => $this->getLocale(), $keys[2] => $this->getPromotionTypeName()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aPromotionType) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'promotionType'; break; case TableMap::TYPE_FIELDNAME: $key = 'promotion_type'; break; default: $key = 'PromotionType'; } $result[$key] = $this->aPromotionType->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['Promotion'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['Promotion'][$this->hashCode()] = true; $keys = PromotionTableMap::getFieldNames($keyType); $keys_resource = \App\Propel\Map\ResourceTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getPromotionId(), $keys[1] => $this->getResourceId(), $keys[2] => $this->getPromotionTypeId(), $keys[3] => $this->getPromotionValue(), $keys[4] => $this->getPromotionGift(), $keys[5] => $this->getPromotionDescription(), $keys[6] => $this->getPromotionStartingPoint(), $keys[7] => $this->getPromotionStartingDate(), $keys[8] => $this->getPromotionEndingDate(), $keys[9] => $this->getPromotionIsActive(), $keys[10] => $this->getCreatedAt(), $keys[11] => $this->getUpdatedAt(), $keys_resource[1] => $this->getResourceType(), $keys_resource[2] => $this->getSocialViews(), $keys_resource[3] => $this->getSocialLikes(), $keys_resource[4] => $this->getSocialDislikes(), $keys_resource[5] => $this->getSocialComments(), $keys_resource[6] => $this->getSocialFavourites(), $keys_resource[7] => $this->getSocialRecommendations()); if ($result[$keys[7]] instanceof \DateTime) { $result[$keys[7]] = $result[$keys[7]]->format('c'); } if ($result[$keys[8]] instanceof \DateTime) { $result[$keys[8]] = $result[$keys[8]]->format('c'); } if ($result[$keys[10]] instanceof \DateTime) { $result[$keys[10]] = $result[$keys[10]]->format('c'); } if ($result[$keys[11]] instanceof \DateTime) { $result[$keys[11]] = $result[$keys[11]]->format('c'); } $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aResource) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'resource'; break; case TableMap::TYPE_FIELDNAME: $key = 'resource'; break; default: $key = 'Resource'; } $result[$key] = $this->aResource->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aPromotionType) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'promotionType'; break; case TableMap::TYPE_FIELDNAME: $key = 'promotion_type'; break; default: $key = 'PromotionType'; } $result[$key] = $this->aPromotionType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }