CakePHP: Error: Database table cake_errors for model CakeError was not found - cakephp

I have a CakePHP error and I having a hard time to trace the problem. Hope you can help me.
Here is the error message:
Missing Database Table
Error: Database table cake_errors for model CakeError was not found.
Notice: If you want to customize this error message, create app/views/errors/missing_table.ctp
Am I missing something here?
Thanks in Advance.
Cheers,
Mark

Its hard to tell why exactly without seeing the code firsthand, one trick i have used with theese kinds of errors though is making "app/views/errors/missing_table.ctp" as inserting the following code
<?php pr( Debugger::trace() ); ?>
This will will help workout what you called to cause this issue in the first place.

I realize this question is 4 years old, but since I bumped into the exact same problem and found no information about it that could explain where the error is coming from, I did some digging of my own and come up with some clues that I include here in case it helps.
My AppController beforeFiler() method, amongst other things, uses a function that checks if the Model of the Controller has enum fields (I know... I know...) and handles them "properly".
When an error in the application triggers an Exception (Nothing fancy... a "Missing Controller" does it) and the debug level is 0, the CakeErrorController tries to render the exception and it fails because there's no cake_errors table, generating an endless loop that ends when PHP runs out of memory.
I fixed this by improving the detection of whether the main Model of the controller is indeed using a "real" table.

Related

Understanding Build Error: Method code too large

When sending Andoird Build to server I get the following build error:
Error! Failed to transform some classes java.lang.RuntimeException:
Method code too large! at
net.orfjackal.retrolambda.asm.MethodWriter.getSize(MethodWriter.java:2036)
at
net.orfjackal.retrolambda.asm.ClassWriter.toByteArray(ClassWriter.java:827)
at
net.orfjackal.retrolambda.Transformers.transform(Transformers.java:121)
at
net.orfjackal.retrolambda.Transformers.transform(Transformers.java:106)
at
net.orfjackal.retrolambda.Transformers.backportClass(Transformers.java:46)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:72) at
net.orfjackal.retrolambda.Main.main(Main.java:26)
I must confess I'm not sure why this is occurring as I do not references these classes. Could someone please explain how to track down the cause and fix it? I have not added any new imports since the last successful build :/ My project is also set to use Java 8. Not sure where to go from here to be honest.
there is a hard limit on the size of methods in a class file of 64k. You have at least one big method that you need to split up. It may have been coming in just under the limit for the initial compilation but the retrolambda conversion just pushed it over. You need to split these methods into smaller methods.
This error doesnt really give you a clue as to which methods are problematic but you can probably eyeball it.

ng-model problems in a directive

I am trying to write my first non-trivial directive and am having problems.
What I am trying to do is similar to http://plnkr.co/nYSBnm
This works as intended apart from the two inputs are using the same field. When I try and get them to use the intended fields, by putting
ng-model="record.{{field.name}}"
in the formInput attributes to replace ng-model="record.name" I get an error
Error: Syntax Error: Token '{' is an unexpected token at column 8 of the expression [record.{{field.name}}] starting at [{{field.name}}].
For what it is worth the plunk is at http://plnkr.co/O2uosO27khbcxZEeEb6V
I have looked at various somewhat similar questions on here and stack overflow and so far failed to get anything to work.
I would be grateful for any light anyone can throw on it.
Mark
I had also asked this question on the AngularJS group (I posted here after a day or so of silence on there). Then I got a response from Pawel Kozlowski who pointed out that
ng-model="record[field.name]"
"kind of starts to work" as he put it. There is a plunk here.
Not sure what he meant by his comment but when I put that in a real page and hit refresh I get two copies of the fields (unless I clear the cache), but he certainly solved the stated problem.

java.lang.UnsupportedOperationException thrown when getObjectById() called

I have an entity with a Key set as follows:
KeyFactory.Builder keyBuilder = new KeyFactory.Builder(MyClass.class.getSimpleName(), "uniqueString");
Key = keyBuilder.getKey();
To fetch an entity by key I reconstruct the key in the exact same way and call getObjectById() as follows;
App app = pm.getObjectById(MyClass.class, keyBuilder.getKey());
Most of the time this works fine but at certain times getObjectById throws this error:
java.lang.UnsupportedOperationException
Does anyone know what causes this? I realise this seems like a very vague problem I've described here but that's really all I know. It's so strange it seems like it may even be a bug with App Engine.
Could the issue be the same as this one, which seems may be a bug in the GAE code? If it is the same, some users have posted work-arounds to the problem.

Why am I getting an undefined property error when my relationships seem correct?

I'm having a slight problem that I can't figure out, but should be really simple.
I have the following model structure in my cakePHP (1.3) app:
ProspectiveQuote [hasMany] QuoteUnit [belongsTo] Unit
but in my ProspectiveQuotesController the line:
$this->ProspectiveQuote->QuoteUnit->Unit->find('list');
gives me the following error:
Undefined property: AppModel::$Unit
Of course, it shouldn't be looking at AppModel, it should be looking at QuoteUnit.
If I do $this->ProspectiveQuote->QuoteUnit->find('all') it seems to get results (allbeit without any related model data...) so it obviously finds the QuoteUnit well enough, and I have double-checked its relationship with Unit, and it all seems fine...
Seems like a simple enough problem. From what I can see people with this problem usually have their model names wrong (or plural) but this is not the case here...
What could I be doing wrong?
I would say to double check over the syntax of your model associations to make sure they are correct. Or back them up, and bake out some new models to test with, just to ensure that it's how you expect it.
Another great thing is to grab the DebugKit http://www.ohloh.net/p/cakephp-debugkit Which will help you to see your variables and your sql queries.
As mentioned in Leo's comment I would try and avoid uses() as it puts, or did put in 1.2 a bit of a big overhead onto your stack.
Have you set var $uses = array('ProspectiveQuote','QuoteUnit','Unit'); in your controller? (although there are slightly more efficient ways of doing this) - see http://book.cakephp.org/2.0/en/controllers.html#controller-attributes
If you do this you can access your associated models like:
$this->Unit->find('list');
or
$this->ProspectiveQuote->QuoteUnit->Unit->find('list');
I know which I prefer.

Hierarchy Constraint Violation -- salesforce.com

Salesforce has thrown a new error message at me, and so far I haven't found anything useful in the docs about this. I am trying to save an object in a controller extension, and it does in fact save the record, but instead of returning to the page that I indicate, it shows me the error message "Hierarchy Constraint Violation". In looking over the debug logs, this does not show up anywhere, despite the fact that I log as error any DML exceptions and re-throw them. I am not stifling any other exceptions, either.
I can't tell what this error even means, let alone where it is coming from.
The problem turns out to be an attempt to create a self reference.

Resources