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

Fix valid function for the first call #2424

Merged
merged 2 commits into from
May 14, 2014
Merged

Fix valid function for the first call #2424

merged 2 commits into from
May 14, 2014

Conversation

alkana
Copy link
Contributor

@alkana alkana commented May 12, 2014

commit 5c9bf86,

Problem : the function valid respond false the first time when the fetchAll must be done.

Solution : set directly rows field after the fetch.

Example to reproduce :
#1 Create table

CREATE TABLE IF NOT EXISTS user (
user_id int(10) unsigned NOT NULL AUTO_INCREMENT,
email varchar(70) CHARACTER SET utf8 NOT NULL,
password char(32) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (user_id),
UNIQUE KEY email_password (email,password)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

INSERT INTO user (user_id, email, password) VALUES
(1, '[email protected]', 'pass1'),
(2, '[email protected]', 'pass2');
#2 (use scaffold of phalcon-devtool)

phalcon scaffold --table-name user
#3 Search all result (juste enter in http://127.0.0.1/user/index page

or check like this :
$users = User::find();
while ($users->valid() !== false) {
echo "user : " . $users->current()->email . '
';
}

commit 8af3f1e,

Fix resultSet->seek function. replace range by while loop because range(0, 0) do one loop and apply next function.

phalcon pushed a commit that referenced this pull request May 14, 2014
Fix valid function for the first call
@phalcon phalcon merged commit f9f4370 into phalcon:2.0.0 May 14, 2014
@phalcon
Copy link
Collaborator

phalcon commented May 14, 2014

Thanks

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

Successfully merging this pull request may close these issues.

2 participants