コード例 #1
0
ファイル: RoleI18n.php プロジェクト: mtornero/slowshop
 /**
  * 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['RoleI18n'][$this->hashCode()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['RoleI18n'][$this->hashCode()] = true;
     $keys = RoleI18nTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getRoleId(), $keys[1] => $this->getLocale(), $keys[2] => $this->getRoleName());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aRole) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'role';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'role';
                     break;
                 default:
                     $key = 'Role';
             }
             $result[$key] = $this->aRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
コード例 #2
0
ファイル: User.php プロジェクト: mtornero/slowshop
 /**
  * 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);
     $keys_resource = \App\Propel\Map\ResourceTableMap::getFieldNames($keyType);
     $result = array($keys[0] => $this->getUserId(), $keys[1] => $this->getResourceId(), $keys[2] => $this->getUseName(), $keys[3] => $this->getUserSurname(), $keys[4] => $this->getUserLogin(), $keys[5] => $this->getUserPass(), $keys[6] => $this->getUserPassIsTemp(), $keys[7] => $this->getRememberToken(), $keys[8] => $this->getUserEmail(), $keys[9] => $this->getUserPhone(), $keys[10] => $this->getUserAddress(), $keys[11] => $this->getRoleId(), $keys[12] => $this->getUserIsValidated(), $keys[13] => $this->getUserIsActive(), $keys[14] => $this->getUserPic(), $keys[15] => $this->getCreatedAt(), $keys[16] => $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[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->aFile) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'file';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'file';
                     break;
                 default:
                     $key = 'File';
             }
             $result[$key] = $this->aFile->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aRole) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'role';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'role';
                     break;
                 default:
                     $key = 'Role';
             }
             $result[$key] = $this->aRole->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         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->collOrders) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'orders';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'orders';
                     break;
                 default:
                     $key = 'Orders';
             }
             $result[$key] = $this->collOrders->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSocialViews) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'socialViews';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'social_views';
                     break;
                 default:
                     $key = 'SocialViews';
             }
             $result[$key] = $this->collSocialViews->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSocialLikes) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'socialLikes';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'social_likes';
                     break;
                 default:
                     $key = 'SocialLikes';
             }
             $result[$key] = $this->collSocialLikes->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSocialComments) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'socialComments';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'social_comments';
                     break;
                 default:
                     $key = 'SocialComments';
             }
             $result[$key] = $this->collSocialComments->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSocialRecommendationsRelatedByUserId) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'socialRecommendations';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'social_recommendations';
                     break;
                 default:
                     $key = 'SocialRecommendations';
             }
             $result[$key] = $this->collSocialRecommendationsRelatedByUserId->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collSocialRecommendationsRelatedBySocialRecommendationTo) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'socialRecommendations';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'social_recommendations';
                     break;
                 default:
                     $key = 'SocialRecommendations';
             }
             $result[$key] = $this->collSocialRecommendationsRelatedBySocialRecommendationTo->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collUserPeriodicPlans) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'userPeriodicPlans';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'user_periodic_plans';
                     break;
                 default:
                     $key = 'UserPeriodicPlans';
             }
             $result[$key] = $this->collUserPeriodicPlans->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collWishlists) {
             switch ($keyType) {
                 case TableMap::TYPE_CAMELNAME:
                     $key = 'wishlists';
                     break;
                 case TableMap::TYPE_FIELDNAME:
                     $key = 'wishlists';
                     break;
                 default:
                     $key = 'Wishlists';
             }
             $result[$key] = $this->collWishlists->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }