Cphalcon: Rename methods `getSchema`, `getSource` on Mvc\Model

Created on 3 May 2019  路  8Comments  路  Source: phalcon/cphalcon

I propose we rename the methods getSchema and getSource to getModelSchema and getModelSource. Though this is just a bandaid.

I'm open to anything, as long as the ORM isn't restricting what I can use as column names.

discussion stale

Most helpful comment

I'm hesitant to change it to anything else. I think this is something we should address when we look at building the model system with the data mapper pattern.

All 8 comments

What about model_schema column name ?

Like I said, I'm open to anything, perhaps even renaming those methods to _getSchema or something. Whatever it takes to prevent the restriction of using certain column names.

Code style like _getSchema will cause PSR/Code style error notifications from the 3rd party tools for those users who will use inheritance in PHP :man_shrugging:

Anyway columMap is your friend in such cases :wink:

I'm hesitant to change it to anything else. I think this is something we should address when we look at building the model system with the data mapper pattern.

I agree with this, many times there are issues and you can't use pretty much column name as name of get* method from model because it will break some functionalities. I think we should either rename such methods or simply just throw exception if we get any of reserved columns as name and tell them to use columnMap and other property name on class than in database.

What if this was moved out of the model into the base database class.
$schema = $this->db->getSchema(Model::class);

That way you can avoid conflicts.

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yakovlev-Melarn picture Yakovlev-Melarn  路  3Comments

richmilns picture richmilns  路  3Comments

kkstun picture kkstun  路  3Comments

bestirani2 picture bestirani2  路  3Comments

hailie-rei picture hailie-rei  路  3Comments