#60 ✓resolved
Schirkan

Creating Models from existing tables doesn't work

Reported by Schirkan | January 30th, 2009 @ 06:00 PM | in 0.12

That's the error message I get:

Undefined index: fields

Location: Line 209 of /srv/www/web204/html/recess/recess/lib/recess/apps/tools/controllers/RecessToolsAppsController.class.php

* 205:            $dataSource = $values['dataSource'];
* 206:            $createTable = $values['createTable'] == 'Yes' ? true : false;
* 207:            $tableName = $values['tableName'];
* 208:        }
* 209:        $propertyNames = $values['fields'];
* 210:        $primaryKey = $values['primaryKey'];
* 211:        $types = $values['types'];
* 212:        
* 213:        Library::import('recess.database.orm.Model', true); 
* 214:        // Forcing b/c ModelDescriptor is in Model

Comments and changes to this ticket

  • Kris Jordan

    Kris Jordan February 4th, 2009 @ 05:41 PM

    • State changed from “new” to “open”

    Interesting and unable to reproduce. Which internet browser are you using? This is likely an issue with the Javascript client side improperly submitting the form.

  • Schirkan

    Schirkan February 5th, 2009 @ 04:14 PM

    Hello,

    I'm using the latest version of Firefox, but I don't think, that's the problem.

    I think I found the problem in the HTML-code:

    
    <h3><input name="tableExists" value="__yes__" type="radio"> Table does not exist.</h3>
    
    [...]
    
    <h3><input name="tableExists" value="__no__" type="radio"> Table already exists.</h3>
    

    I think the values have to be interchanged.

    This was the corresponding Request & Response

    
    POST /recess/recess/apps/app/SnippetsApplication/model/gen HTTP/1.1
    Host: schirkan.de
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729) FirePHP/0.2.1
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Referer: http://schirkan.de/recess/recess/apps/app/SnippetsApplication/model/gen
    Cookie: PHPSESSID=0dc1b4d4729ea232389568a9f83b0d2d
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 91
    modelName=Category&tableExists=no&existingDataSource=Default&existingTableName=sn_categorys
    
    HTTP/1.x 500 Internal Server Error
    Date: Thu, 05 Feb 2009 21:00:40 GMT
    Server: Apache/2.2.3 (Debian) mod_ssl/2.2.3 OpenSSL/0.9.8c
    X-Powered-By: PHP/5.2.6-0.dotdeb.1
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html
    
  • Luiz Alberto Zaiats

    Luiz Alberto Zaiats February 5th, 2009 @ 06:27 PM

    Just wondering why:

    modelName=Category&tableExists=no&existingDataSource=Default&existingTableName=sn_categorys

    Doesn't make sense to me... How could it have a tableExists=no and a existingTableName=sn_categorys ?

    LZ

  • Kris Jordan

    Kris Jordan March 30th, 2009 @ 09:52 PM

    • Milestone changed from 0.11.1 to 0.12

    Moving this ticket to the next maintenance release due out shortly: 0.11.2

  • Kris Jordan

    Kris Jordan March 31st, 2009 @ 02:48 PM

    • State changed from “open” to “resolved”

    Fixed the pointed out logic error in commit 8611f453

    Still don't believe this is at the root of your problem as the post content does not have a fields[] array. This leads me to suspect something in the jQuery went wrong but I've tested in the latest Firefox release without fail.

  • simon.rycroft

    simon.rycroft January 19th, 2010 @ 04:09 PM

    This problem still exists for me in version 0.20. Replicated in in Firefox and IE.

    If I try to create a model based on an existing database I get:

    Undefined index: fields

    Location: Line 208 of D:\xampp\htdocs\recess\recess\recess\apps\tools\controllers\RecessToolsAppsController.class.php

    Any ideas please?

  • simon.rycroft

    simon.rycroft January 19th, 2010 @ 04:19 PM

    Well I think I just found a bug :-(

    If you select an existing datasource and click 'Generate Model' it errors out with 'undefined index'.

    However if you go back the the 'ew Model Helper' page, select 'Table does not exist' and then change it to 'Table already exists' the model will be generated correctly.

    I'm surprised more people haven't reported this.

  • ehpc

    ehpc July 6th, 2010 @ 01:53 PM

    • Milestone order changed from “0” to “0”

    Have the same issue in 0.20. Firefox 3.6.6. And unlike simon.rycroft, I cannot get it to work...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Recess PHP Framework is an open source, full stack, RESTful PHP framework.

http://www.recessframework.org/

People watching this ticket

Pages