src/Entity/Repository.php
/**
     * This returns a count of all records in the table - is copy pasta from the method above as I was
     * running out of time. Given more time, I would have abstracted these more into smaller methods
     *
     * @param $table
     * @return mixed
     */
This returns a count of all records in the table - is copy pasta from the method above as I was
running out of time. Given more time, I would have abstracted these more into smaller methods

@param $table
@return mixed
This returns a count of all records in the table - is copy pasta from the method above as I was running out of time . Given more time I would have abstracted these more into smaller methods @param $table @return mixed
public function countAllFrom($table)
    {
        $table = preg_replace('/[^A-Za-z0-9_]+/', '', $table);
        $query = "SELECT COUNT(*) FROM `$table`";
        if ($result = $this->mysqli->query($query)) {
            return $result->fetch_row()[0];
        }
    }
public function countAllFrom ( $ table ) { $ table = preg_replace ( '/[^A-Za-z0-9_]+/' , '' , $ table ) ; $ query = " SELECT COUNT(*) FROM ` $ table ` " ; if ( $ result = $ this -> mysqli -> query ( $ query ) ) { return $ result -> fetch_row ( ) [ 0 ] ; } }
This returns a count of all records in the table - is copy pasta from the method above as I was
 running out of time.
This returns a count of all records in the table - is copy pasta from the method above as I was running out of time .
// Make sure the table name does not have any dodgy chars in it // which might offer a way for SQL Injection // Select all the records from the current table. Yes I am using "Select *" here which I // would not do in real life. I'd explicitly select the fields, probably by using a field // list in each table class, or perhaps using annotations like Doctrine does