Comments (6)
can you provide your SQL?
from yii2-enhanced-gii.
This item should be reproducible by creating a table/model with a composite primary key and running the CRUD app. You will see that you can't update or delete a record until you manually put the rest of the composite key fields into the update/delete button's code as listed above.
from yii2-enhanced-gii.
Whew.. could you help me to fix this?
from yii2-enhanced-gii.
Did you find what you needed? The ticket says closed is why I ask. I can provide example how to fix if still necessary.
from yii2-enhanced-gii.
Hi, maybe your database schema is not right, did u use foreign keys? did your database have 2 primary keys? i've tried on my schema and it's working properly...
from yii2-enhanced-gii.
this is my schema
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.6.20 - MySQL Community Server (GPL)
-- Server OS: Win32
-- HeidiSQL Version: 9.1.0.4904
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for gii
CREATE DATABASE IF NOT EXISTS `gii` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `gii`;
-- Dumping structure for table gii.child1
CREATE TABLE IF NOT EXISTS `child1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`deleted_by` int(11) DEFAULT NULL,
`lock` bigint(20) DEFAULT NULL,
`master_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_child1_master_idx` (`master_id`),
CONSTRAINT `fk_child1_master` FOREIGN KEY (`master_id`) REFERENCES `master` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
-- Dumping structure for table gii.child2
CREATE TABLE IF NOT EXISTS `child2` (
`created_at` datetime DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`deleted_by` int(11) DEFAULT NULL,
`lock` bigint(20) DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`master_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_child2_master1_idx` (`master_id`),
CONSTRAINT `fk_child2_master1` FOREIGN KEY (`master_id`) REFERENCES `master` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
-- Dumping structure for table gii.junction
CREATE TABLE IF NOT EXISTS `junction` (
`master_id` int(11) NOT NULL,
`master2_id` int(11) NOT NULL,
PRIMARY KEY (`master_id`,`master2_id`),
KEY `FK__master2` (`master2_id`,`master_id`),
CONSTRAINT `FK__master` FOREIGN KEY (`master_id`) REFERENCES `master` (`id`),
CONSTRAINT `FK__master2` FOREIGN KEY (`master2_id`) REFERENCES `master2` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
-- Dumping structure for table gii.master
CREATE TABLE IF NOT EXISTS `master` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created_at` datetime DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`deleted_by` int(11) DEFAULT NULL,
`lock` bigint(20) DEFAULT NULL,
`absensicol` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
-- Dumping structure for table gii.master2
CREATE TABLE IF NOT EXISTS `master2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Column` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
from yii2-enhanced-gii.
Related Issues (20)
- In model generator tinyint create rules as string
- No results found. HOT 1
- Error when the instance of a model is created - Softdelete and Blameable Behavior HOT 1
- Custom Model Template HOT 1
- PHP version HOT 1
- wrong table name generated when table name has "_" in it HOT 1
- When I updated the master record, the child record on all related tables is soft deleted. HOT 1
- Generate migration column tinyint give error result
- Can't detect if in the model function beforesave the object is soft deleted HOT 1
- "Call to a member function getColumnNames() on null" HOT 1
- Open redirect in crud/default/views/_form.php HOT 2
- Models and CRUD generation in batch command HOT 1
- Edit Generator Code HOT 3
- PDOException: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: HOT 2
- Model generation getRelations() bug
- Auto increment primary keys fails HOT 3
- bit, tinyint to boolean
- deletedByValueRestored is always 0
- HasMany: Update > valdiation error Message > update again >The object being updated is outdated. HOT 1
- Switch to twig or another templating engine? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-enhanced-gii.