PHP Fatal error: Call to a member function getColumn() on a non-object in propel-gen diff - propel

When I try to change the table structures using propel I am getting a Fatal error when I try to execute propel-gen diff. So how to resolve the issue?
PHP Fatal error: Call to a member function getColumn() on a non-object in /usr/share/php/data/propel_generator/lib/reverse/mysql/MysqlSchemaParser.php on line 329

This happens when there's a parsing error in your schema. You've probably changed something in your schema and that's now causing the failure. Best you undo whatever change to the last valid schema, then try and re-apply your changes bit by bit and validate as you're making change.
It's difficult thought to point out the issue without your schema.

Related

Laravel with SQLite returns error: "SQLSTATE[HY000]: General error: 1 no such function: SQRT"

I use a SQLite database for a Laravel 8 project. I get an error message when I try to query it.
Query: Model::selectRaw('col1,col2,col3,(6368 * SQRT(2*(1-cos(RADIANS(col1)))))')->get();
Error: SQLSTATE[HY000]: General error: 1 no such function: SQRT.
What am I doing wrong? Or is this query even possible with SQLite? Thank you for help!
According to my comment:
It is possible, you could use sqrt(). But you need to make sure that you have the math library enabled according to the docs: sqlite.org/lang_mathfunc.html#sqrt "but are only active if the amalgamation is compiled using the -DSQLITE_ENABLE_MATH_FUNCTIONS compile-time option."

Compilation problem while running the sdm package in Rstudio

I am getting this error when compiling:
Error in FUN(X[[i]], ...): trying to get slot "presence" from an object of a basic class ("NULL") with no slots
How can I solve this?
You should check the formula to see whether you are indicating the same name
ie
sdmdata<- sdmData(**species~.,** train, test, predictors, bg..)
Writing this in the model will give you an error you described.
sdmmodel<- sdm(**specie~.,** data= methods=c("glm", "brt")).
I solved a similar problem that way

How to have usefull debugging or error messages from laravel

I'm a bit new to laravel, but I'm experienced in Php.
In previous works, I set a mecanism that allowed me to be informed when nearly any problem occurred on the server:
I got full stack
precise PHP error messages
for nearly all king of errors
a mail sent to me
So when I began to work with laravel, I tried to do the same things, and achieved:
full stack
a mail sent to me
But I can't have meaningful error in all case. One example:
$store = Store::create(...)
In this line I forget to specify the namespace (\App\Store::create), and I get those error messages:
first:
FatalThrowableError ; Type error: Argument 1 passed to App\Http\Controllers\User::create() must be an instance of Illuminate\Http\Request, array given, called in /var/www/html/laravel/blog/app/Http/Controllers/User.php on line 94
second:
ErrorException ; Trying to get property of non-object in VerifyCsrfToken.php (line 156)
third:
FatalThrowableError ; Type error: Argument 1 passed to Illuminate\Session\Middleware\StartSession::addCookieToResponse() must be an instance of Symfony\Component\HttpFoundation\Response, array given, called in /var/www/html/laravel/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php on line 72
I understand that laravel is a complex framework but I can't figure why it produces this errors, and how I can have more useful errors (as as it is I can only know that "something is bad").
Has someone an idea ?
ยน There is some errors that Php prefers to keep to himself (in its logs) :-)
When you start a new Laravel project, error and exception handling is
already configured for you. The App\Exceptions\Handler class is where
all exceptions triggered by your application are logged and then
rendered back to the user.
https://laravel.com/docs/5.4/errors
I recommend you to dive into the official docs and into your App\Exceptions\Handler.
Maybe you are looking for report and render methods in that class.
I finally cornered the problem and I learned a lot.
I thank for their benevolence #Don't Panic and #Vitalmax !
The error was that I forgot that PHP namespaces are case insensitive: in my post I cleaned a bit the code as I knew that it didn't stick to the code's conventions (a controller's name must begin with a capital letter). Originally my controller name was user and the faulty code was:
$user = User::create(...)
As you can guess PHP believed that I wanted to call user::create (as I have such a method in my controller) and not User::create (as I wanted).
What I learned:
don't alter the code when asking for help
Laravel use a cache system that can get in the way of the debugging (see a question that I asked on laracast's forum )
take more time to read the error message; I know this rule but I keep doing otherwise

Cannot read property 'findElementsOverride' of undefined

Protractor/jamine error message:
Failed: Cannot read property 'findElementsOverride' of undefined
any clue on whats causing this error message?
More details would have helped.At-least what caused the error:)
But I have faced this issue before and you will see this when using isElementPresent() in scenarios like below
expect(body.isElementPresent()).toBeTruthy();
The problem is that isElementPresent() is checks based on subLocator and doesnt accept null as argument
The docs state the proper way of using it
This checks whether the element identified by the subLocator is
present, rather than the current element finder
element(by.css('#abc')).isElementPresent(by.css('#def')).

SWIG php how to call reference arguments

I am trying to use my C++ libraries in PHP with SWIG, everything work fine and I generated my shared object precisely. I also include phppointers.i and std_string.i in my interface file. but when I want to call my C++ methods which have reference or pointer arguments in their input section, the method just would not work properly or I got some errors like :
Fatal error:no matching function
for example one of my methods is declared as below:
int func(string &ptr,bool space=true) const;
but when I call this method in my php code as:
$bf->func('abcd',true);
I got this error:
Fatal error:no matching function
I tried to call this function with other ways like:
$str = 'abcd';
$bf->func(&$str,true);
but this time I got following error:
Fatal error: Call-time pass-by-reference has been removed
I am totally confused, I truly appreciate if someone can help me with this problem.

Resources