db === null) { $resourceName = $this->Config()->get('db', 'resource'); if ($resourceName) { $this->db = Db::fromResourceName($resourceName); } else { $this->fail('Director is not configured correctly'); } } return $this->db; } }