-
Notifications
You must be signed in to change notification settings - Fork 132
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
Overriding the default table naming behavior doesn't work #101
Comments
It was missed in the last release and shouldn't have gone into the docs. A pull request to add it was made earlier today: #100 |
This functionality should work in the current release - according to the unit tests, it does work. |
@redjee could you confirm in your You should see some lines similar to the following
|
I thought he was referring to the global. My bad! |
Yes, I'm using the latest version of Idiorm (1.5.1) and Paris (1.5.3). |
@redjee Could you run the following test app for me and tell me the results. You will need to have PHP's sqlite3 PDO driver installed to run this (or you can setup and configure a real DB with From the CLI, do
I expect, and get, the following output:
If you examine the source you will notice that the classes are declared in a The Let us know your results. |
This test passed successfully. |
And one more note: |
Also static class variables are ignored in function |
Thankyou @redjee - I will look in to the issues. |
Hi there @redjee, thanks for taking the time to run the test app. I've investigated your issues as much as possible, and here is what I have found. ExamplesI have updated the test app. Either clone it again or do a Expected output this time is:
Have a browse through the examples in index.php and see how they relate to the issues I discuss below. First issue
We're using a namespace - you must use model prefixes or add the namespace to the parameter. Instead try
or
Second issueCalling a Model using the static methods, e.g. When we pass a class name to the factory method, this parameter will be combined with the model prefix to determine which class to use. In the sample code, if we add
Then we would attempt to call a class of Using the static method:
in this situation PHP must already know the namespace for I will see if we can prevent this situation through code - at the very least I will note the limitation in the docs. Use of the Third issue
I haven't done any testing on this, but could it be related to the namespace issue as in issue one? tl;dr
|
@redjee Have you had any time to try the updated tests as mentioned above? |
@michaelward82 Your tests passed successfully. Thank you for advanced explanation, now it became clearly for me, problem was in wrong use of namespace feature. I think we can close this issue. |
Excellent. |
To disregard namespace information when calculating the table name:
class User extends Model {
public static $_table_use_short_name = true;
}
To override the default naming behaviour and directly specify a table name:
class User extends Model {
public static $_table = 'my_user_table';
}
I have found it in the documentation. But it doesn't work for me.
php version: 5.5.6
The text was updated successfully, but these errors were encountered: