Symfony - Cannot fetch ColumnMap for undefined column - php

Bang Bang BANG.... (sound of my head hitting the wall)
Unable to execute UPDATE statement. [wrapped: Cannot fetch ColumnMap for undefined column:: DISCOUNTCODE
I've read this question but it wasn't any help to me as I do not have any table prefixes in my propel.ini
Does anyone know what could be causing this error?
And yes I have cleared my cache, rebuilt my schema and model countless times.
The only clue to my problem is that it does work on my localhost, and not on the live server.
If I look in the base class I do see const DISCOUNTCODE = orders.DISCOUNTCODE
Please help...

I've run into this many times. We may have had different problems but what's worked for me is completely deleting the model map files then rebuilding everything:
rm -rf lib/model/map/*

Related

Unable to create package in module builder or Deploy a new package in SuiteCRM

I am unable to create a new package from module builder. In module builder, when I enter a package name and key and hit save, it does nothing.
When I inspect in chrome, the console logs the following error:
Uncaught TypeError: Cannot read property 'value' of undefined
at validate_form (sugar_grp1.js:228)
at check_form (sugar_grp1.js:160)
at Object.handleSave (ModuleBuilder.js:905)
at HTMLInputElement.onclick (/XXXXXX/index.php?module=ModuleBuilder&action=index&type=mb#ajaxUILoc=&mbContent=module%3DModuleBuilder%26action%3Dpackage%26new%3D1:1)
Any suggestions on what I can look at or do to debug?
I'm using SuiteCRM 7.7.8
Php 7
I thought this might be a permissions issue, so i made sure all folders and files are 755 and tried to create the package again but got the same error.
I do not have any custom modules. this was the first one im trying to build.
I get similar errors if i try to export a module in studio also.
When I dig deeper, the exact line that fails in sugar_grp1.js is var current_module=document.getElementsByName("view_module")[0].value;
There is no element with name view_module on the page. It appears that this is happening to other users also. Please see: https://suitecrm.com/community/forum/suitecrm-7-0-discussion/12418-unable-to-create-package-in-module-builder#42665
UPDATE: I have done the usual repair and rebuild everything along with JS groupings and JS. Still the same.
An easy solution, see following steps:
Open /cache/include/javascript/sugar_grp1.js
Go to line 228 or find the next text:
var current_fields='';var current_module=document.getElementsByName("view_module")[0].value;$.ajax({type:"GET",url:"index.php?to_pdf=1&module=ModuleBuilder&action=getModuleFields&current_module="+current_module,async:false,success:function(result){current_fields=JSON.parse(result);},error:function(xhr,status,error){var err=eval("("+xhr.responseText+")");}});for(k=0;k<current_fields.length;k++){if(isError!=true){val=current_fields[k].toUpperCase();if((operator=="=="&&val==item1)||(operator=="!="&&val!=item1)){isError=true;add_error_style(formname,validate[formname][i][nameIndex],'Invalid Value: Field Name already exists');}}}
Remove this line.
QuickRepair.
Clear your Browser Cache and try again.

Symfony 2 can't do single console command and no proper error

I've been working quite a while on a Symfony2 project and it looks very nice.
However, to save some time lately I've been programming a lot without actually testing the functionality. Obviously I didn't push it to the live environment either.
Now I'm trying to start the built-in PHP server to run my project locally to see what I broke by coding blindly and ... well, I must've broken something BIG.
app/console server:start
Hangs for a few seconds and finally I get an error:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: Invalid argument supplied for foreach()
That's it. There's literally nothing more in the console. It doesn't say where I made a mistake, whether it's in my code (no class names, no lines) or somewhere else... This is like a needle in a haystack.
I've tried running it with the --force flag because it's just a warning, maybe it could continue and crash again later (and give me a proper reason why then), but I get the same error.
All the other command like trying to clear the cache, trying to validate my doctrine schema's etc. produce the exact same result. Nothing in the logs either. Not even in /var/logs/apache2.
I've manually cleared the cache and try to run the server again to see if maybe it would show me a different error. It does manage to create a folder structure:
.
└── dev
├── annotations
├── classes.map
├── jms_aop
├── jms_security
└── serializer
But doesn't manage to place anything inside these folders. So I think I'm getting the error rather quickly.
I'm looking for a needle in a haystack over here... I've looked through my code, figuring out if I made a stupid mistake in my foreach loops but I don't see anything.
Is there any way I can get more debugging information from Symfony? A simple class name or line would help me figure out what the underlying cause might be but this is just madness. I don't even have a clue where to start.
UPDATE:
#JimL pointed out to me that I could increase the verbosity level of the console command output.
By adding -vvv to the output I managed to get a full stack trace of the exception. Once I saw the last line:
/Users/A Sneaky Ginger/path/to/my/project/vendor/jms/serializer-bundle/JMS/SerializerBundle/DependencyInjection/Compiler/RegisterEventListenersAndSubscribersPass.php:48
at first I was confused because this isn't a file which I've edited myself. But after a few head scratches I could figure out that one of my EventListeners had the code:
static public function getSubscribedEvents()
{
//return array(
//array("event" => "serializer.post_serialize", "class" => "Acme\myBundle\Entity\myEntity", "method" => "onPostSerialize")
//);
}
Which was causing the invalid parameter given to the foreach().
I still think a small hint could've been included by default in the warning message because this was really too vague, but luckily JimL saved the day.
When you use the CLI you're not using Apache so no errors should end up there. You could change the verbosity level
http://symfony.com/doc/current/components/console/introduction.html#verbosity-levels

Completely Reseting Laravel 5 Migration Stuff?

To make a long story short, I have completely messed up my Laravel migrations on my local machine. They are 100% unusable.
I'm working with Laravel 5 for the first time, so I'm just messing with stuff and testing the waters, so to speak. Between manually tinkering with the database, rewriting my migrations, accidentally deleting a table or two (then the 'migrations' table itself [doh!]), I'm in this mixed-up state, and I just want to start all of the migration stuff over from scratch. However, I can't seem to figure out how to do that.
I'm currently stuck in a state where I can't do anything.
For example, if any remnants of old tables are still in the database when I perform php artisan migrate:refresh, I get a Base table or view already exists error message. However, if I delete all the tables, I get this error:
Next exception 'Illuminate\Database\QueryException' with message
'SQLSTATE[42S02]: Base table or view not found: 1146 Table
'bsd_status.projects' doesn't exist (SQL: select * from `projects`)' in
path/to/src/Illuminate/Database/Connection.php:620
I've run the following commands:
$ php artisan clear-compiled
$ php artisan cache:clear
$ php composer dump-autoload
$ php artisan migrate:install
I'm not even sure I'm doing this stuff in the right order. Anyway, other than completely reinstalling Laravel, how does one get all his/her migrations back to "out-of-the-box?" Any help would be greatly appreciated. Thanks!
What I liked to do is manually delete all the tables with what ever tool you use on your device. For me I just use phpmyadmin. After that I do.
php artisan migrate:install
php artisan migrate:refresh
Don't know if this is the official way, but it works every time.
If you don't want to use phpmyadmin you can just
login to mysql via command line
mysql -u root -p
DROP DATABASE laraveldb;
CREATE DATABASE laraveldb;
Although #Goddard's answer and #nozzleman's comment were both really helpful (I've used both suggestions several other times, so thank you), the solution had nothing to do with migrations. Well, … other than the fact that I screwed them up to begin with.
Anyway, nothing I did fixed the issue, so I put on my "think really f'ing hard" hat. After cursing for several minutes, I realized something. It appeared that — even when simply running artisan from the command line — any routes or providers I had set up were attempting to be "resolved" (or whatever the proper terminology is). Thus, I must have had a call somewhere attempting to get data from the missing table when the app started the bootstrap/init/start/run phase.
I decided to make sure I didn't have any weird things going on in my actual code, so I checked in my routes file (app/Http/routes.php) and all my Service Provider files (app/Providers/*) to see if I was trying to retrieve model data in any of them. Lo and behold, I opened app/Providers/AppServiceProvider.php and found this:
AppServiceProvider.php
public function boot()
{
$layout = 'default';
if ( Request::has('layout') ) {
$layout = Request::input('layout');
}
view()->share('sharedAppData', [
'layout' => $layout,
'projects' => App\Project::all() // <- WTF, mate?
]);
}
If you recall, the table being complained about in the error messages was named "projects." Thus, I was attempting to get all projects at boot, so no matter what I did (at the command line or otherwise), nothing was going to work because my Eloquent-extended model (App\Project) was looking for a table that simply didn't exist anymore.
The moral of the story: Laravel is super complex, I suck at it, and no matter how many times I try to follow the teachings of the great Jeffery Way, I'll forever be a Laran00b.
try this:
composer dump-autoload
composer clear-cache

Multiple issues during Sylius installation

im trying to install Sylius with composer for an e commerce project however i just cant get it done..i follow the docs but i always get an other error when i fix one.
already fixed some errors eg. incl extension exception, paypal bundle renaming issues on git and memory size problem.
Now where im stuck:
When i fill the parameters with the interactive script
if i give any password for the database i get this:
Doctrine\DBAL\Driver\PDOException
Acces denied for user 'root'#localhost
if i dont give password then i get this:
Doctrine\DBAL\Driver\PDOException
SQLSTATE[HY000]Unknown database databasename_dev (it appends _dev prefix)
then in both cases it ends up with this: RunTimeException
An error occured when executing the ""cache:clear --no-warmup"" command
and the proccess is terminated with this exception..
i tried if i could continue with the $ cd acme
$ php app/console sylius:install commands but:
if i gave a password then get acces denied Doctrine\DBAL\Exception\ConnectionException
if didnt then Doctrine\DBAL\Driver\PDOException
SQLSTATE[HY000]Unknown database databasename_dev
i created the database manually which seems to solve the problem however get this: General error: 1007 cant create database databasename_dev; database exists
(i dont think this solution is the right one)
but after this it doesnt terminate yet and creates the database schema and then after some installation it terminates with this:
RuntimeException
The source file "C:\Users\user\acme\app/../web/bundles/cmfcreate/vendor/create/themes/midgard-tags/tags.css" does not exists
i checked the page if it may useable but got twig exception that currency not found and many components are missing from the page..
What's your workspace?
If you work on Windows with WAMP I'll give you some things to check :
set the database port to : 3306
create a new user for the database, juste for your sylius project
when you run create-project commande, in databaseport write : localhost
I hope it helps you.

Magento error when running Cron.php

I am getting this error when I run the cron.php for Magento.
[24-Jan-2015 02:40:03 UTC] PHP Fatal error: Class 'Mage__Helper_Data' not found in /home/nli/catalog/app/Mage.php on line 516
I found a few other pages where someone else had this problem but I am unable to fix this. The two underscores must be the issue but I cannot find anywhere in my Magento directories with grep where there is any mention of Mage__Helper_Data or anything calling that class.
Please let me know if you have any ideas on what I could check. This has been happening for at least a couple months so I have no idea what happened or which plugins were installed at the exact time.
Thank you!
-Justin
This should be in one of the config.xml files in your system; it seems like one word is missing between Mage_ and _Helper; btw what is the grep command you are using? try with: grep "Mage__Helper" . -rin , from the top folder. I'm sure you'll find something.
A magento developer was able to take a look at our system and found the issue was within a 3rd party magento plugin that had a corrupt row in the database table that was causing the Mage__Helper_Data error.

Categories