Question

I create Doctrine from MySQL database in Symfony with this command :

php app/console doctrine:mapping:convert yml ./src/Sifo/SchoolBundle/Resources/config/doctrine --from-database --force 
php app/console doctrine:mapping:import --force SifoSchoolBundle yml
php app/console doctrine:generate:entities SifoSchoolBundle --force

The problem is one of table not generated (dft_grup_pelajar). I've tried building the database several times but still didn't work. Am I missing something? Here is the result:

Processing entity "DftAbsensi"
Processing entity "DftGrup"
Processing entity "DftGrupMapel"
Processing entity "DftNilai"
Processing entity "MstJabatan"
Processing entity "MstKelas"
Processing entity "MstKelompok"
Processing entity "MstMapel"
Processing entity "MstPegawai"
Processing entity "MstPelajar"
Processing entity "MstPeriode"
Processing entity "MstProgram"
Processing entity "MstSemester"

Here the relation http://prntscr.com/3dz2n5

--
-- Table structure for table `dft_grup_pelajar`
--

CREATE TABLE IF NOT EXISTS `dft_grup_pelajar` (
  `kode_grup` varchar(20) NOT NULL,
  `kode_pelajar` varchar(20) NOT NULL,
  `aktif` tinyint(1) NOT NULL DEFAULT '1',
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `operator` varchar(20) NOT NULL,
  PRIMARY KEY (`kode_grup`,`kode_pelajar`),
  KEY `kode_pelajar` (`kode_pelajar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


--
-- Constraints for table `dft_grup_pelajar`
--
ALTER TABLE `dft_grup_pelajar`
  ADD CONSTRAINT `dft_grup_pelajar_ibfk_1` FOREIGN KEY (`kode_grup`) REFERENCES `dft_grup` (`kode`) ON UPDATE CASCADE,
  ADD CONSTRAINT `dft_grup_pelajar_ibfk_2` FOREIGN KEY (`kode_pelajar`) REFERENCES `mst_pelajar` (`kode`) ON UPDATE CASCADE;
Was it helpful?

Solution

create the table manually, dont specify structure--then rerun your commands Check to make sure you have dbuser permissions set correctly (ie you have privileges to create table) and there is not some table another user set up with a conflicting name.

OTHER TIPS

(Posted answer on behalf of the question author).

This case is now solved. The problem is, there was no Primary Key. Two of them became Foreign Key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top