Doctrine 1
  1. Doctrine 1
  2. DC-214

./symfony doctrine:build-all-reload: Warning: array_flip(): Can only flip STRING and INTEGER values

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 1.2.0-BETA1, 1.2.0-BETA2
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Ubuntu, Symfony 1.3.0-DEV

      Description

      I hope this is not a symfony bug
      But the code where I get the error is in the doctrine svn, that' why I report here.

      I use sfDoctrineGuardPlugin as an external in my project. Because Doctrine 1.2 has the COOL new feature to override a plugin's schema.yml with the project's, I have changed the table for sfGuardUser in the project's schema.yml:

      sfGuardUser:
        actAs:
          ClientAware: {foreignAlias: Users}
          Timestampable:
        columns:
          id: {type: integer, primary: true, autoincrement: true }
          username: {type: string(128), notnull: true, unique: true }
          algorithm: {type: string(128), default: sha1, notnull: true }
          salt: {type: string(128) }
          password: {type: string(128) }
          is_active: {type: boolean, default: 1 }
          is_super_admin: {type: boolean, default: 0 }
          last_login: {type: timestamp }
          firstName:  { type: string, name: first_name, notnull: false, default: null }
          lastName:   { type: string, name: lastname, notnull: false, default: null }
          email:       { type: string, notnull: false, default: null}
          birthdate:   { type: date, notnull: false, default: null, past: true }
        indexes:
          is_active_idx:
            fields: [is_active]
        relations:
          groups:
            class: sfGuardGroup
            local: user_id
            foreign: group_id
            refClass: sfGuardUserGroup
            foreignAlias: Users
          permissions:
            class: sfGuardPermission
            local: user_id
            foreign: permission_id
            refClass: sfGuardUserPermission
            foreignAlias: Users
      

      When I try to build the model, I receive this warning:

      Warning: array_flip(): Can only flip STRING and INTEGER values! in /var/www/shared/fotoshop/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php on line 725
      
      Call Stack:
          0.0011      54188   1. {main}() /var/www/shared/project/symfony:0
          0.0175     327060   2. include('/var/www/shared/project/lib/vendor/symfony/lib/command/cli.php') /var/www/shared/project/symfony:14
          0.3650    6788500   3. sfSymfonyCommandApplication->run() /var/www/shared/project/lib/vendor/symfony/lib/command/cli.php:20
          0.3715    6814472   4. sfTask->runFromCLI() /var/www/shared/project/lib/vendor/symfony/lib/command/sfSymfonyCommandApplication.class.php:76
          0.3715    6814472   5. sfBaseTask->doRun() /var/www/shared/project/lib/vendor/symfony/lib/task/sfTask.class.php:97
          0.4203    7451160   6. sfDoctrineBuildAllReloadTask->execute() /var/www/shared/project/lib/vendor/symfony/lib/task/sfBaseTask.class.php:67
          0.4210    7463896   7. sfTask->run() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildAllReloadTask.class.php:85
          0.4215    7469544   8. sfBaseTask->doRun() /var/www/shared/project/lib/vendor/symfony/lib/task/sfTask.class.php:173
          0.4224    7472808   9. sfDoctrineBuildTask->execute() /var/www/shared/project/lib/vendor/symfony/lib/task/sfBaseTask.class.php:67
          2.4554    9762780  10. sfTask->run() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php:156
          2.4556    9762780  11. sfBaseTask->doRun() /var/www/shared/project/lib/vendor/symfony/lib/task/sfTask.class.php:173
          2.4559    9762780  12. sfDoctrineBuildModelTask->execute() /var/www/shared/project/lib/vendor/symfony/lib/task/sfBaseTask.class.php:67
          2.8183   10001504  13. Doctrine_Import_Schema->importSchema() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php:72
          3.2427   10889828  14. Doctrine_Import_Builder->buildRecord() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Schema.php:285
          3.2428   10889828  15. Doctrine_Import_Builder->writeDefinition() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php:987
          3.2428   10889828  16. Doctrine_Import_Builder->buildDefinition() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php:1081
          3.2443   10894200  17. Doctrine_Import_Builder->buildSetUp() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php:895
          3.2450   10894628  18. Doctrine_Import_Builder->buildActAs() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php:459
          3.2450   10894628  19. Doctrine_Import_Builder->innerBuildActAs() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php:701
          3.2450   10894628  20. array_flip() /var/www/shared/project/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Builder.php:725
      
      
      Variables in local scope (#19):
        $actAs = array (0 => 'Timestampable', 'ClientAware' => array ('foreignAlias' => 'Users'), 'Timestampable' => NULL)
        $emittedActAs = array ()
        $name = *uninitialized*
        $value = *uninitialized*
        $optionPHP = *uninitialized*
        $realOptions = *uninitialized*
        $currentParent = *uninitialized*
        $build = *uninitialized*
        $level = 0
        $options = *uninitialized*
        $template = *uninitialized*
        $parent = NULL
        $leftActAs = *uninitialized*
      
      

      This happens only when this table definition is in the overriding schema.yml. If I put this definition in the plugin's schema.yml, it is working correctly.

      This warning is in fact an error, because the model class' setUp method does not include:

              $clientaware0 = new ClientAware(array(
                   'foreignAlias' => 'Albums',
                   ));
              $this->actAs($clientaware0);
      

      I could fix this behaviour with the patch.

        Activity

        Hide
        Jonathan H. Wage added a comment -

        This isn't anything to do with Doctrine code.

        Show
        Jonathan H. Wage added a comment - This isn't anything to do with Doctrine code.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Georg
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: