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

Added commonly used method #60

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/ZfcBase/Mapper/AbstractDbMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ protected function select(Select $select, $entityPrototype = null, HydratorInter
return $resultSet;
}

/**
* @return array
*/
public function getAll()
{
$dbresult = $this->select($this->getSelect());
$result = array();
while($dbresult && $entity = $dbresult->current()) {
$result[] = $entity;
}
return $result;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@foaly-nr1

The indentation is totally messed up.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been 2 years since I posted this, I am not sure if the PR is still relevant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we haven't needed it up to this point, it's probably best to close it anyway. Any modules using ZfcBase have implemented this themselves already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I retract my prior statement...it would be nice to have this, but implemented like this:

/**
 * @return ResultSetInterface
*/
public function findAll()
{
    return $this->select($this->getSelect());
}

Together with #64, this would remove the necessity for ZfcUserAdmin\Mapper\ZendDbMapper::findAll

/**
* @param object|array $entity
* @param string|TableIdentifier|null $tableName
Expand Down