/** * 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['FileTypeI18n'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['FileTypeI18n'][$this->hashCode()] = true; $keys = FileTypeI18nTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getFileTypeId(), $keys[1] => $this->getLocale(), $keys[2] => $this->getFileTypeName()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aFileType) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'fileType'; break; case TableMap::TYPE_FIELDNAME: $key = 'file_type'; break; default: $key = 'FileType'; } $result[$key] = $this->aFileType->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['File'][$this->hashCode()])) { return '*RECURSION*'; } $alreadyDumpedObjects['File'][$this->hashCode()] = true; $keys = FileTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getFileId(), $keys[1] => $this->getFileTypeId(), $keys[2] => $this->getFilePath(), $keys[3] => $this->getCreatedAt(), $keys[4] => $this->getUpdatedAt()); if ($result[$keys[3]] instanceof \DateTime) { $result[$keys[3]] = $result[$keys[3]]->format('c'); } 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->aFileType) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'fileType'; break; case TableMap::TYPE_FIELDNAME: $key = 'file_type'; break; default: $key = 'FileType'; } $result[$key] = $this->aFileType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collCategories) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'categories'; break; case TableMap::TYPE_FIELDNAME: $key = 'categories'; break; default: $key = 'Categories'; } $result[$key] = $this->collCategories->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collNews) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'news'; break; case TableMap::TYPE_FIELDNAME: $key = 'news'; break; default: $key = 'News'; } $result[$key] = $this->collNews->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collPeriodicPlans) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'periodicPlans'; break; case TableMap::TYPE_FIELDNAME: $key = 'periodic_plans'; break; default: $key = 'PeriodicPlans'; } $result[$key] = $this->collPeriodicPlans->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collProducts) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'products'; break; case TableMap::TYPE_FIELDNAME: $key = 'products'; break; default: $key = 'Products'; } $result[$key] = $this->collProducts->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collProviders) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'providers'; break; case TableMap::TYPE_FIELDNAME: $key = 'providers'; break; default: $key = 'Providers'; } $result[$key] = $this->collProviders->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collResourceFiles) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'resourceFiles'; break; case TableMap::TYPE_FIELDNAME: $key = 'resource_files'; break; default: $key = 'ResourceFiles'; } $result[$key] = $this->collResourceFiles->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collUsers) { switch ($keyType) { case TableMap::TYPE_CAMELNAME: $key = 'users'; break; case TableMap::TYPE_FIELDNAME: $key = 'users'; break; default: $key = 'Users'; } $result[$key] = $this->collUsers->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }