-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codegen breaking models #107
Comments
have you cloned master or another branch? |
Environment: I found the issue. Appears to be a file encoding issue since we moved to GitHub's repository. The issue is with the GO_BACK function in QCodeGenBase. The class_load_and_count_methods.tpl.php calls it on line 39 passing an integer of value 2 to remove the last comma. This works fine on all my existing codebases, however on the clone I made from master on GitHub it fails. I used my debugger to look at the code and here is what the output looks like before GO_BACK does its string manipulation https://www.dropbox.com/s/lolavo8uz3g5w1n/before.png and then after https://www.dropbox.com/s/8u6zpv4706c0tqp/after.png . It appears that we have a windows versus Linux EOL issue. Windows carriage return is \r\n while it is \n in Unix. Therefore in Windows the comma is the third character not the second. |
Example of the issue comparing index_load_single.tpl.php https://www.dropbox.com/s/v9nmn2x3zkmbeny/diff_index_load_single.tpl.php.png. Are any others experiencing this when developing on Windows? |
I have not tried qcubed on a windows machine. I'll do that and report results here. |
This might be strange because I am using the code from master in a small installation and it works well with MySQL (no such errors). BUt I am on Linux (opensuse) / Apache 2.2 / PHP 5.3.18 / MySql 5.5 |
The issue seems to be isolated to running QCubed in a Windows environment. I was able to put the same code-base on an Ubuntu VM and everything runs well. I ran a diff on the download I have from before the switch to GitHub and a clone from the master repo and a lot of the files have had the encoding and line endings changed. I don't think this would be an issue accept that the codegen is writing from the templates and the functions like GO_BACK are relying on the output being consistent. I think from here we need to normalize all the files to use the same EOL characters and encoding. Once this is accomplished I feel we should have a process in place to test the framework on Windows, Mac and Linux environments before it is merged to master. |
GO_BACK is an ugly hack I had to put in place when doing automatic conversion from old templates to php templates. There aren't that many of them, we should eliminate them all |
Agreed, we have normalized the directory separators so I don't see why we shouldn't do the same for EOL. |
The tutorial on line-endings with git: https://help.github.com/articles/dealing-with-line-endings |
The instruction was obtained here: https://help.github.com/articles/dealing-with-line-endings in a "Re-normalizing a repo" part.
fixed in #154 |
Cloned the framework repository locally and and setup the test database in MySql. After running codegen I am getting the following error:
Parse error: syntax error, unexpected ')' in C:\wamp\www\framework\includes\model\generated\PersonGen.class.php on line 194
It appears that there may be an error in the codegen templates. The generated code looks like:
// Use QuerySingle to Perform the Query
$objToReturn = Person::QuerySingle(
QQ::AndCondition(
QQ::Equal(QQN::Person()->Id, $intId),
),
$objOptionalClauses
);
I've looked through the logs and cannot see any changes that would ave affected this. Is it possible that the logs from SVN did not transfer into GIT completely?
The text was updated successfully, but these errors were encountered: