Hi, i've already posted something referred to this issue in the FormIt section, but it was going off topic (and it hasn't received any answer) so i removed that post and i'm opening a new one.. Please
I have 2 custom tables setup correctly, newObject() + save() works for creating new entries in this custom table. But when i try to remove() some object from one of these tables, it always return false and nothing happens. I tried to remove objects without istantiating it, removeCollection() worked but removeObject() returns false as $obj->remove().
I also have an issue on $obj->save() function after setting fields of an existing object in this class. If i try to get an object, set some fields and $obj->save(), it returns true but nothing happens in the database..
This is my schema and tables definition:
<?xml version='1.0' encoding='UTF-8'?>
<model package='idicola' baseClass='xPDOObject' platform='mysql' defaultEngine='MyISAM'>
<object class='Newspaper' table='newspaper' extends='xPDOObject'>
<field key='id' dbtype='int' precision='10' phptype='integer' null='false' generated="native"/>
<field key='publisher_id' dbtype='int' precision='10' phptype='integer' null='false' index='index'/>
<field key='name' dbtype='varchar' precision='255' phptype='string' null='false'/>
<field key='tag' dbtype='varchar' precision='255' phptype='string' null='false'/>
<aggregate alias='modUser' local='publisher_id' foreign='id' cardinality='one' owner='foreign' />
<composite alias='Publication' local='id' foreign='newspaper_id' cardinality='many' owner='local' />
</object>
<object class='Publication' table='publication' extends='xPDOObject'>
<field key='id' dbtype='int' precision='10' phptype='integer' null='false' generated="native"/>
<field key='newspaper_id' dbtype='int' precision='10' phptype='integer' null='false' index='newsp' />
<field key='publisher_id' dbtype='int' precision='10' phptype='integer' null='false' index='index' />
<field key='name' dbtype='varchar' precision='255' phptype='string' null='false'/>
<field key='pub_date' dbtype='date' phptype='date' null='false' />
<field key='file_name' dbtype='varchar' precision='255' phptype='string' null='false' />
<field key='exp_date' dbtype='date' phptype='date' null='true' />
<field key='cost' dbtype='int' precision='5' phptype='integer' null='false' />
<field key='public' dbtype='tinyint' precision='1' phptype='integer' null='false' default='0' />
<field key='paid' dbtype='tinyint' precision='1' phptype='integer' null='false' default='0' />
<field key='type' dbtype='tinyint' precision='1' phptype='integer' null='false' default='0' />
<field key='tag' dbtype='varchar' precision='255' phptype='string' null='false'/>
<field key='description' dbtype='varchar' precision='255' phptype='string' null='false'/>
<aggregate alias='modUser' local='publisher_id' foreign='id' cardinality='one' owner='foreign' />
<aggregate alias='Newspaper' local='newspaper_id' foreign='id' cardinality='one' owner='foreign' />
</object>
</model>
CREATE TABLE IF NOT EXISTS modx_newspaper (
id int(10) NOT NULL AUTO_INCREMENT,
publisher_id int(10) NOT NULL,
name varchar(255) NOT NULL,
tag varchar(255) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (publisher_id) REFERENCES modx_users(id)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=MyISAM
CREATE TABLE IF NOT EXISTS modx_publication (
id int(10) NOT NULL AUTO_INCREMENT,
newspaper_id int(10) NOT NULL,
publisher_id int(10) NOT NULL,
name varchar(255) NOT NULL,
pub_date date NOT NULL,
file_name varchar(255) NOT NULL,
exp_date date,
cost int(5) NOT NULL,
public tinyint(1) NOT NULL DEFAULT 0,
paid tinyint(1) NOT NULL DEFAULT 0,
type tinyint(1) NOT NULL DEFAULT 0,
tag varchar(255) NOT NULL,
description varchar(255) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (newspaper_id) REFERENCES modx_newspaper(id)
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY (publisher_id) REFERENCES modx_users(id)
ON DELETE CASCADE
ON UPDATE CASCADE
) ENGINE=MyISAM
[ed. note: mau1989 last edited this post 14 years, 7 months ago.]