Yeah, so the "conventions" approach would be to use:
Primary Key: id (int 11, or char 36)
Foreign Key: name_id (int 11 or char 36) where "name" is the singular name of a
model.
Example:
CREATE TABLE `posts` (
`id` CHAR(36) NOT NULL PRIMARY KEY,
`user_id` CHAR(36) NOT NULL,
`name` VARCHAR
Actually, that worked... It's perfect
As far as database structure... would this be a "standard" way of
structuring my tables?
Table 1 (users)
id usernamepassword
Table 2 (posts)
id postuser_idtype_id
Table 3 (types)
type_idtype_name
On Nov 29, 5:48 pm, Graham Weldon w
Let me clarify...
private function isActionable($id)
{
if($this->Session->read('Auth.User.role') == 'admin'){
return true;
}
$post = $this->Period->find('first', array(
'conditions' => array(
'id' => $id,
It looks like the issue is with your non-standard database structure, perhaps.
On your Model/Period.php model, set the primary key to be 'period_id' since
that looks like your primary key:
class Period extends AppModel {
public $primaryKey = 'period_id';
/// Other code here...
}
Do
I know why it's not working, I just cannot figure out how to fix it.
These are my errors:
1. Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id'
in 'where clause'
2. SQL Query: SELECT `Period`.`period_id`, `Period`.`title`,
`Period`.`created`, `Period`.`modified`, `Period`.`user_id`