我使用以下命令从 Symfony 中的 MySQL 数据库创建 Doctrine:
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
问题是未生成的表之一(dft_grup_pelajar)。我已经尝试过多次构建数据库,但仍然无法正常工作。我错过了什么吗?结果如下:
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"
这里的关系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;