No reference found for $images->dgalerie
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- mordare
- Začátečník | 117
Dobrý mám takový dotez. mám tabulky
SET NAMES utf8;
SET foreign_key_checks = 0;
SET time_zone = 'SYSTEM';
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `dgalerie`;
CREATE TABLE `dgalerie` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`image` int(10) NOT NULL,
`galerie` int(5) NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `galerie` (`galerie`),
KEY `image` (`image`),
CONSTRAINT `dgalerie_ibfk_3` FOREIGN KEY (`image`) REFERENCES `images` (`id`),
CONSTRAINT `dgalerie_ibfk_1` FOREIGN KEY (`galerie`) REFERENCES `galerie` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
DROP TABLE IF EXISTS `images`;
CREATE TABLE `images` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`link` varchar(50) NOT NULL,
`link_cropped` varchar(60) NOT NULL,
`width` int(4) NOT NULL,
`height` int(4) NOT NULL,
`title` varchar(100) NOT NULL,
`author` int(6) NOT NULL,
`Tdate` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `author` (`author`),
CONSTRAINT `images_ibfk_1` FOREIGN KEY (`author`) REFERENCES `clenove` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
a v modelu z nich tahám data pomocí
$this->m_images = self::$_conn->table('images')->select('*')->select('dgalerie:order')->where('images.id', 'dgalerie.image')->where('dgalerie.order', $this->m_id)->order('dgalerie.order ASC, dgalerie.id ASC');
foreach ($this->m_images as $image) {
$image = new ImageModel($image);
}
místo dat ale dostanu laděnku s hláškou
No reference found for $images->dgalerie.
tabluky mají nastavené cizí klíče a catch sem skoušel mazat taky.