Friday, January 25, 2013

Bake of controller error in 2.3.0-RC2 and 2.2.5.

When I bake a certain controller, I get an issue where the sql has a directory added.  Any ideas?
(The [app directory] part is my edit.  The directory is correct.)

.........AS "Folder" LEFT JOIN "public"."folders" AS "ParentFolder" ON ("Folder"."parent_id" = "ParentFolder"."id") LEFT JOIN "public"."users" AS "User" ON ("Folder"."user_id" = "User"."id") LEFT JOIN "public"."content_access_roles" AS "ContentAccessRole" ON ("Folder"."content_access_role_id" = "ContentAccessRole"."id")  WHERE "Folder"."id" = '[app directory]/lib/Cake/Console/Templates/default'    LIMIT 1

Yes, it actually throw the Templates/default directory name and full path into the SQL string. Which postgresql throws up on.

Error: SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for integer: "[app directory]/lib/Cake/Console/Templates/default"
LINE 1: ...ic"."folders" AS "Folder"   WHERE "Folder"."id" = '[app directory]...
                                                             ^
#0 [app directory]/lib/Cake/Model/Datasource/DboSource.php(459): PDOStatement->execute(Array)
#1 [app directory]/lib/Cake/Model/Datasource/DboSource.php(425): DboSource->_execute('SELECT "Folder"...', Array)
#2 [app directory]/lib/Cake/Model/Datasource/DboSource.php(669): DboSource->execute('SELECT "Folder"...', Array, Array)
#3 [app directory]/lib/Cake/Model/Datasource/DboSource.php(1080): DboSource->fetchAll('SELECT "Folder"...', false)
#4 [app directory]/lib/Cake/Model/Model.php(2642): DboSource->read(Object(Folder), Array)
#5 [app directory]/lib/Cake/Model/Model.php(1519): Model->find('first', Array)
#6 [app directory]/lib/Cake/Console/Command/Task/TemplateTask.php(76): Model->read()
#7 [app directory]/lib/Cake/Console/Command/Task/TemplateTask.php(51): TemplateTask->_findThemes()
#8 [app directory]/lib/Cake/Console/Shell.php(443): TemplateTask->initialize()
#9 [app directory]/lib/Cake/Console/Command/Task/ControllerTask.php(293): Shell->__get('Template')
#10 [app directory]/lib/Cake/Console/Command/Task/ControllerTask.php(178): ControllerTask->bakeActions('Folders', NULL, true)
#11 [app directory]/lib/Cake/Console/Command/Task/ControllerTask.php(61): ControllerTask->_interactive()
#12 [app directory]/lib/Cake/Console/Command/BakeShell.php(113): ControllerTask->execute()
#13 [app directory]/lib/Cake/Console/Shell.php(395): BakeShell->main()
#14 [app directory]/lib/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)
#15 [app directory]/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
#16 [app directory]/app/Console/cake.php(33): ShellDispatcher::run(Array)
#17 {main}

My Postgres table:

CREATE TABLE folders(
    id serial NOT NULL PRIMARY KEY,
    parent_id integer DEFAULT NULL, -- tree behaviour
    lft integer default NULL,
    rght integer default NULL,
    is_valid boolean default true,
    title varchar(255),
    creation_date timestamp default NOW(),
    user_id integer REFERENCES users(id),
    xml_import_field varchar(255),
    ordinal integer default 0,
    content_access_role_id integer
);




--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: