-
-
Save DenisMir/63064fc49ff9c5d272a07c79f56dd618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function findByUid() | |
{ | |
$uid = 1234; | |
$fields = '*'; | |
$table = 'some_table'; | |
$where = 'some_table.uid = :uid'; | |
$params = array( | |
':uid' => $uid | |
); | |
$this->db->store_lastBuiltQuery = 1; | |
/** @var PreparedStatement $preparedQuery */ | |
$preparedQuery = $this->db->prepare_SELECTquery($fields, $table, $where); | |
$preparedQuery->execute($params); | |
$this->logger->debug('Found rows: ' . $preparedQuery->rowCount()); | |
$this->logger->debug('Last build query: ' . $this->db->debug_lastBuiltQuery); | |
if ($preparedQuery->rowCount() > 0) { | |
$row = $preparedQuery->fetch(); | |
$this->logger->debug('Result found'); | |
} else { | |
$this->logger->debug('No result found. Returning null.'); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment