Symfony “No field or association”, only happening when i use capifony for deployment-Collection of common programming errors
I have been struggling for the past few days with capifony, every time when i deploy it seems to be throwing the following error:
[2012-12-26 15:09:57] request.CRITICAL: Doctrine\ORM\Query\QueryException: [Semantical Error] line 0, col 111 near 'user = u.id WHERE': Error: Class MyName\MyBundle\Entity\Uservote has no field or association named user (uncaught exception) at /home/**user***/public_html/****/shared/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php line 49 [] []
however everything is working perfectly on localhost and it also works when i zip the entire folder and manually copy it to the server (not a good way of deploying a symfony app)
This error occurs with capifony
my deploy.rb
set :application, "****"
set :domain, "***.hostgator.com"
set :deploy_to, "/home/***/public_html/test.***.org/"
set :app_path, "app"
set :web_path, "web"
set :user, "*****"
set :port, "2222"
set :use_sudo, false
set :php_bin, "/opt/php53/bin/php"
set :assets_install, false
default_run_options[:pty] = true
#SYMFONY 2 SPECIFIC
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :use_composer, true
set :update_vendors, true
set :cache_warmup, true
set :repository, "[email protected]/****/***.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`
set :vendors_mode, "install"
set :model_manager, "doctrine"
# Or: `propel`
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Symfony2 migrations will run
set :keep_releases, 3
# IMPORTANT = 0
# INFO = 1
# DEBUG = 2
# TRACE = 3
# MAX_LEVEL = 3
logger.level = Logger::MAX_LEVEL
# Be more verbose by uncommenting the following line
# logger.level = Logger::MAX_LEVEL
#SPEED UP DEPLOY
# Symfony2 2.1
#before 'symfony:composer:update', 'symfony:copy_vendors'
namespace :symfony do
desc "Copy vendors from previous release"
task :copy_vendors, :except => { :no_release => true } do
if Capistrano::CLI.ui.agree("Do you want to copy last release vendor dir then do composer install ?: (y/N)")
capifony_pretty_print "--> Copying vendors from previous release"
run "cp -a #{previous_release}/vendor #{latest_release}/"
capifony_puts_ok
end
end
end
# Fix persmissions on VPS
after "deploy:update_code" do
namespace :symfony do
capifony_pretty_print "--> Fixing permissions"
run "cd #{latest_release} && find . -type f -exec chmod 644 {} \\;"
run "cd #{latest_release} && find . -type d -exec chmod 755 {} \\;"
capifony_puts_ok
end
end
after "deploy", "deploy:cleanup"
I am pretty sure that my Useraccounts entity is correct, but to be sure here it is
Originally posted 2013-11-27 12:10:03.