This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Invalid mapping Exception

Discuss installing Symfony 2 here

Invalid mapping Exception

by thek » Mon Aug 12, 2013 8:11 pm

Hi together,

I havae a problem with generate entities from a database.
I use this documentation:
http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html

First I execute this command:
Code: Select all
php app/console doctrine:mapping:convert xml ./src/Acme/TestBundle/Resources/config/doctrine --from-database --force


and it works fine.

But then, I want to convert the mapping to annotations:
Code: Select all
php app/console doctrine:mapping:convert annotation ./src


and I get this error:
Code: Select all
[Doctrine\Common\Persistence\Mapping\MappingException]                       
  Invalid mapping file 'Acme.TestBundle.Entity.Users.orm.yml' for class 'Acme 
  \TestBundle\Entity\Users'. 


My database schema is this:

Code: Select all
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;

SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

CREATE  TABLE IF NOT EXISTS `users` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(45) NULL ,
  `firstname` VARCHAR(45) NULL ,
  `username` VARCHAR(45) NULL ,
  `password` VARCHAR(32) NULL ,
  `admin` TINYINT(1) NULL ,

  PRIMARY KEY (`id`) )
ENGINE = InnoDB;

CREATE  TABLE IF NOT EXISTS `worktime` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `title` VARCHAR(60) NULL ,
  `description` TEXT NULL ,
  `customer` VARCHAR(45) NULL ,
  `hours` FLOAT NULL ,
  `billed` TINYINT(1) NULL ,
  `price` FLOAT NULL ,
  `user_id` INT NOT NULL ,

  PRIMARY KEY (`id`) ,
  INDEX `fk_worktime_user_idx` (`user_id` ASC) ,
  CONSTRAINT `fk_worktime_user`
    FOREIGN KEY (`user_id` )
    REFERENCES `users` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;


Does anyone know what's wrong here?

Cheers!
thek
Junior Member
 
Posts: 1
Joined: Mon Aug 12, 2013 8:00 pm