Binary Relationships in Chapter 13 of PHP & MySQL Novice to Ninja


I’m hoping someone can help me. There appears to be some discrepancy between what is in the book and what is in the sample code.

First of all the sample code doesn’t appear to have the functionality for hasPermission() in Author.php (in the Entity folder) or savePermission() at all in the Register.php controller and there doesn’t appear to be a next section of sample code to review from there.

I have coded my files exactly as the book says (though I believe there’s a missing variable declaration in Author.php as $this->permissions isn’t declared in the class, but used in hasPermission().

I have set my personal author permissions to 63 which should give me permissions to everything. However, when I attempt to go to, I get a access denied page.

My code is here if anyone else wants to try it. Sorry, I don’t have sample data to go with mine, but you can get some at

I truly am stumped here and can’t continue until I figure this out. Thanks in advance!


Hi, @jenhardesty. What were the typos that you found?

This is correct in the sample code.

else if (isset($routes[$this->route]['permissions'])
➥ &&
($$routes[$this->route]['permissions'])) {
header('location: /login/error');

Also, the sample code appears to be missing the functionality for hasPermission() though it’s in the book.

Edit: Dangit. It’s the “$$routes”.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.