Yii Framework Forum: using command line - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

using command line What do I do when model and crud don't work Rate Topic: -----

#1 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 20 December 2009 - 12:17 PM

I have a MySQL db with four tables. From the command line I typed model and a table name and then crud and the table name.

It seems to have worked on three of the four tables. The fourth table will not display. I could not find a command to undo or remove the creation so I went into the protected folder and looked for every reference to the table name and removed them. I have done this about ten times. Before each time I modified the table in some way such as removing enum and shortening the length of the table name and making the table name less similar to another table name. Nothing seems to have worked.

The application log file has the following message:
2009/12/20 10:21:32 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "tGenericAssignments".' in /var/www/yii/framework/web/CWebApplication.php:324
and
2009/12/20 09:46:10 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "tAssignments".' in /var/www/yii/framework/web/CWebApplication.php:324
and
2009/12/19 19:21:25 [error] [exception.CHttpException.403] exception 'CHttpException' with message 'You are not authorized to perform this action.' in /var/www/yii/framework/web/auth/CAccessControlFilter.php:123

I tried to use the command line once as root. Perhaps this upset something.

I am running Ubuntu, Apache, and MySQL on a laptop while trying to learn to use Yii

I really don't know what I am doing. Perhaps trial end error had damaged the setup.
0

#2 User is offline   got 2 doodle 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 248
  • Joined: 12-December 08
  • Location:Beautiful Nova Scotia, Canada

Posted 21 December 2009 - 07:26 AM

View Postjimfuqua, on 20 December 2009 - 12:17 PM, said:

I have a MySQL db with four tables. From the command line I typed model and a table name and then crud and the table name.

It seems to have worked on three of the four tables. The fourth table will not display. I could not find a command to undo or remove the creation so I went into the protected folder and looked for every reference to the table name and removed them. I have done this about ten times. Before each time I modified the table in some way such as removing enum and shortening the length of the table name and making the table name less similar to another table name. Nothing seems to have worked.

The application log file has the following message:
2009/12/20 10:21:32 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "tGenericAssignments".' in /var/www/yii/framework/web/CWebApplication.php:324
and
2009/12/20 09:46:10 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "tAssignments".' in /var/www/yii/framework/web/CWebApplication.php:324
and
2009/12/19 19:21:25 [error] [exception.CHttpException.403] exception 'CHttpException' with message 'You are not authorized to perform this action.' in /var/www/yii/framework/web/auth/CAccessControlFilter.php:123

I tried to use the command line once as root. Perhaps this upset something.

I am running Ubuntu, Apache, and MySQL on a laptop while trying to learn to use Yii

I really don't know what I am doing. Perhaps trial end error had damaged the setup.


what does your table structure look like? I have used the yiic tool on some pretty complex database structures, it works fine so I wouldn't look there first.

and what do you mean "the fourth table will not display"?

doodle
Check out myYii powered website
0

#3 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 21 December 2009 - 12:00 PM

View Postgot 2 doodle, on 21 December 2009 - 07:26 AM, said:

what does your table structure look like? I have used the yiic tool on some pretty complex database structures, it works fine so I wouldn't look there first.

and what do you mean "the fourth table will not display"?

doodle

0

#4 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 21 December 2009 - 12:02 PM

View Postgot 2 doodle, on 21 December 2009 - 07:26 AM, said:

what does your table structure look like? I have used the yiic tool on some pretty complex database structures, it works fine so I wouldn't look there first.

and what do you mean "the fourth table will not display"?

doodle

0

#5 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 21 December 2009 - 12:20 PM

doodle, I will copy the table structure below. Thanks for responding.

By "The fourth table will not display." I mean that I have four table references all created the same way using "model tablename" and "crud tablename". tAssignments, tCompleted and tSessions will all show a screen with "http://localhost/tAssignments/?r=tAssignments" etc, but tLessons will give a blank screen using the same url.

Again this morning I deleted all references to tLessons in the protected folder and tried again with the same result of a blank screen when typing "http://localhost/tLessons/?r=tLessons".

Will deleting from the protected folder and its sub folders all files that appear to be derived from the table name allow one to start over with a new "model tablename" and "crud tablename" or must one start over with a fresh copy of Yii?

The table structure could use some work as there are inconsistencies between the table structure and the comments. I removed the enums on a few of the fields thinking that that might cause a problem for Yii, but I got the same blank screen results.

Neither the commands model or crud cause any error messages when run with tLessons. The procedure displayed after running model tLessons displayed the structure of the table.

I have simplified both the table name and the table structure several times with no change in the results. Below is the current table structure:

-- phpMyAdmin SQL Dump
-- version 3.2.2.1deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 21, 2009 at 11:03 AM
-- Server version: 5.1.37
-- PHP Version: 5.2.10-2ubuntu6.3

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `jlf_edu`
--

-- --------------------------------------------------------

--
-- Table structure for table `tLessons`
--

CREATE TABLE IF NOT EXISTS `tLessons` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`tG_StartStop` char(9) DEFAULT NULL COMMENT 'Some lessons are collected into threads. This record signifies the start or stop of a thread or the non-thread nature of this lesson as it is both a start and an end.',
`tG_Split-or-List` char(5) DEFAULT NULL COMMENT 'A split divides the time between two lessons. A list divides the time between a list of lessons.',
`tG_ThreadName` text NOT NULL COMMENT 'If null this is a single lesson.',
`tG_AssignmentName` char(80) NOT NULL,
`tG_FormName` char(80) NOT NULL COMMENT 'Identifies the view file.',
`tG_TableName` char(80) NOT NULL COMMENT 'Source of the data for the form.',
`tG_StartRec` smallint(5) unsigned NOT NULL COMMENT 'Identifies the data record for this lesson.',
`tG_StopRec` smallint(5) unsigned NOT NULL COMMENT 'Identifies the stop record from the data table.',
`tG_Immediate_Loops` tinyint(3) unsigned NOT NULL COMMENT 'Repeat this exact lesson this number of times.',
`tG_RepsPerRecord` tinyint(3) unsigned NOT NULL COMMENT 'Iterations of a lesson that should be done before going to another record.',
`tG_RecordsPerSet` tinyint(4) NOT NULL,
`tG_Lesson_if_Correct` char(80) NOT NULL COMMENT 'GA to do next if lesson is completed successfully.',
`tG_Lesson_if_Error` char(80) NOT NULL COMMENT 'GA to do next if lesson is not done successfully.',
`tG_Percent_1` tinyint(4) NOT NULL COMMENT 'Used for splits. % of lessons assigned to first split. % is of time assigned to the lesson before the split.',
`tG_Percent_2` tinyint(3) unsigned NOT NULL COMMENT 'Used for splits. % of lessons assigned to second split. % is of time assigned to the lesson before the split.',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `tLessons`
--

INSERT INTO `tLessons` (`id`, `tG_StartStop`, `tG_Split-or-List`, `tG_ThreadName`, `tG_AssignmentName`, `tG_FormName`, `tG_TableName`, `tG_StartRec`, `tG_StopRec`, `tG_Immediate_Loops`, `tG_RepsPerRecord`, `tG_RecordsPerSet`, `tG_Lesson_if_Correct`, `tG_Lesson_if_Error`, `tG_Percent_1`, `tG_Percent_2`) VALUES
(1, NULL, NULL, '', 'tG_typing_101', '/typing/index.html', '', 0, 0, 0, 0, 0, '', '', 100, 0);
0

#6 User is offline   got 2 doodle 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 248
  • Joined: 12-December 08
  • Location:Beautiful Nova Scotia, Canada

Posted 21 December 2009 - 04:20 PM

Quote

Will deleting from the protected folder and its sub folders all files that appear to be derived from the table name allow one to start over with a new "model tablename" and "crud tablename" or must one start over with a fresh copy of Yii?
]

That shouldn't be a problem in fact yiic will tell you before over writing a model file etc.

You might be having problems with
`tG_Percent_1` tinyint(4) NOT NULL COMMENT 'Used for splits. % of lessons assigned to first split. % is of time assigned to the lesson before the split.',
`tG_Percent_2` tinyint(3) unsigned NOT NULL COMMENT 'Used for splits. % of lessons assigned to second split. % is of time assigned to the lesson before the split.',


I'm not sure how mysql treats comments but adding the percent sign would be where I would look next. That being said, I didn't really spend any time looking too hard at your post, I am really strapped for time right now. So take my comment with a grain of salt B)

Did you create that database definition in phpmyadmin?

FWIW I have had good success with InnoDB engine versus Isam and usually hand code the sql and then import, phpmyadmin always lets me know when I have screwed up.

You should probably post more info

doodle
Check out myYii powered website
0

#7 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 23 December 2009 - 10:38 AM

View Postgot 2 doodle, on 21 December 2009 - 04:20 PM, said:

]

That shouldn't be a problem in fact yiic will tell you before over writing a model file etc.

You might be having problems with
`tG_Percent_1` tinyint(4) NOT NULL COMMENT 'Used for splits. % of lessons assigned to first split. % is of time assigned to the lesson before the split.',
`tG_Percent_2` tinyint(3) unsigned NOT NULL COMMENT 'Used for splits. % of lessons assigned to second split. % is of time assigned to the lesson before the split.',


I'm not sure how mysql treats comments but adding the percent sign would be where I would look next. That being said, I didn't really spend any time looking too hard at your post, I am really strapped for time right now. So take my comment with a grain of salt B)

Did you create that database definition in phpmyadmin?

FWIW I have had good success with InnoDB engine versus Isam and usually hand code the sql and then import, phpmyadmin always lets me know when I have screwed up.

You should probably post more info

doodle

0

#8 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 23 December 2009 - 11:09 AM

Doodle

I deleted the entire yii installation and started over. Same problem on reinstallation.

I then started truncating the table by dividing it into two tables. The bottom table would display after crud but the top table would not display. I then divided the top table into two tables etc until I got a table with two lines that would not display. I think the problem must be a bug. I will get the latest yii and try that.

The table that will not display after crud is described below:

CREATE TABLE IF NOT EXISTS `tLessons_top_two_columns2` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`tG_Split-or-List` enum('Split','List') DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

I don't know much about the engines, but will try changing that as you suggested.

I took the original table tLessons and removed the line "`tG_Split-or-List` enum('Split','List') DEFAULT NULL," and it worked ok with crud.

I will try it later with the same line retyped to rule out a non-visible character.

Jim Fuqua
0

#9 User is offline   jimfuqua 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 20-December 09

Posted 23 December 2009 - 11:32 AM

doodle:

I think I found the answer. Something goes wrong when the field name contains a hyphen -.

I modified the original tLessons by changing tG_Split-or-List to tG_Split_or_List and it worked fine with crud.

MySQL does not seem to mind the hyphens, but I have not checked the MySQL documentation to see if a hyphen is forbidden in a field name.

Should I post a bug report or will they read this thread?

Jim Fuqua
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users