Skip to content
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

Following standards for method and variable naming. #115

Closed
hdogan opened this issue Oct 1, 2012 · 8 comments
Closed

Following standards for method and variable naming. #115

hdogan opened this issue Oct 1, 2012 · 8 comments

Comments

@hdogan
Copy link
Contributor

hdogan commented Oct 1, 2012

I think it would be nice to use and follow "camelCase" standard for method and variable naming strictly.

About all Phalcon classes use camelCase standard (for method and variable naming) but I noticed Phalcon\Db\Result\Pdo and Phalcon\Db\Adapter\Pdo does not follow this standard strictly.

So "rowcount" property should be named as "rowCount".

@phalcon
Copy link
Collaborator

phalcon commented Oct 2, 2012

Actually, it's correctly camelized:

https://github.com/phalcon/cphalcon/blob/master/ext/phalcon.c#L491

Also, if you want to read the produced number of rows the method to call is rowCount

http://docs.phalconphp.com/en/latest/api/Phalcon_Db_Result_Pdo.html

@hdogan
Copy link
Contributor Author

hdogan commented Oct 2, 2012

@phalcon I've noticed it on documentation at:

https://phalcon-php-framework-documentation.readthedocs.org/en/latest/reference/models.html?highlight=rowcount#generating-calculations

In example code, line:

echo "There are ", $group->rowcount, " in ", $group->area;

I have no idea where $group->rowcount comes from but I checked source code with my little internal API knowledge and found:

https://github.com/phalcon/cphalcon/blob/master/ext/db/result/pdo.c#L258
https://github.com/phalcon/cphalcon/blob/master/ext/db/adapter/pdo.c#L465

And I have no idea if $group->rowcount is related with these API calls.

@phalcon
Copy link
Collaborator

phalcon commented Oct 2, 2012

ah ok, that's a column alias to easily access the COUNT(*) from the SQL statement

SELECT area, COUNT(*) AS rowcount FROM x

@hdogan
Copy link
Contributor Author

hdogan commented Oct 2, 2012

I hate to call it as "rowcount", is it possible to rename this alias as "rowCount"?

@phalcon
Copy link
Collaborator

phalcon commented Oct 2, 2012

the problem is that we're using pdo with PDO::CASE_LOWER, so even if I change that it will return it always in lowercase...

@hdogan
Copy link
Contributor Author

hdogan commented Oct 2, 2012

Oh I see, using PDO lower case flag is probably related with PostgreSQL's field name handling problem if I remember right.

@phalcon
Copy link
Collaborator

phalcon commented Oct 3, 2012

hi, may I close this?

@hdogan
Copy link
Contributor Author

hdogan commented Oct 3, 2012

@phalcon sure.

@niden niden closed this as completed Oct 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants