Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

fActiveRecord - Insert Id

posted by iamthewinnar 9 years ago

I'm working with fActiveRecord when I have the following:


$file = new File();
$file->setFilename("test");
$file->setCompanyid("1");
$file->store();
echo $file->getId();

The id is still blank. Any thoughts as to why?

Here is what I have for my File class

class File extends fActiveRecord {
    protected function configure() {

    }
}

And here is the print_r for $file

#!text/html
[values:protected] => Array
        (
            [id] => 
            [companyid] => 1
            [filename] => test
        )

I'm not sure what I am doing wrong, any help would be great.

My database table has ID as a primary with Auto Increment I also have an index on companyid

So I found out the issue is because I have multiple indexes on the table. Is there any way around this, or should I just write a query instead?

posted by iamthewinnar 9 years ago

That sounds like a bug in fSchema. Can you paste the output of the SQL query SHOW CREATE TABLE files?

Also, can you paste the output of the following PHP?

fCore::expose(fORMSchema::retrieve()->getColumnInfo('files'));
posted by wbond 9 years ago