gstreamer0.10-ffmpeg
gstreamer0.10-plugins-good
packages.
Look, I know you already understand how to do queries in SQL - maybe you dream of JOINs, orders and sub-queries. That's really dorky, but I get it. But when you look at Doctrine, it's totally different - with its DQL and its query builder, with their own ways of doing joins, and this hydration of objects thing.
But did you know you can write native SQL queries in Doctrine? Yep! And you can opt in or out of any of its features. Use more of them in one place, where life is easier or when you're feeling like a Doctrine pro. Then go simpler and use less when things get tough or you need to squeeze out ever ounce of performance.
We'll learn about all of that. And don't worry - if you're good at SQL, you're going to be great at writing queries in Doctrine.
Our app is a Fortune Cookie inventory system. Yep, we've finally hit the big time: working for a company that can tell you your future, wrapped up inside a cheap cookie shell.
There are six different fortune categories that are loaded from the database. And if you click on any of these, we see all of the fortunes for the category and how many have been printed.
The project is a small Symfony app - but all the Doctrine stuff translates
to any app using the Doctrine ORM. We have 2 entities: Category
and FortuneCookie
:
... lines 1 - 7 | |
/** | |
* Category | |
* | |
* @ORM\Table(name="category") | |
* @ORM\Entity(repositoryClass="AppBundle\Entity\CategoryRepository") | |
*/ | |
class Category | |
{ | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="id", type="integer") | |
* @ORM\Id | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
private $id; | |
/** | |
* @var string | |
* | |
* @ORM\Column(name="name", type="string", length=255) | |
*/ | |
private $name; | |
/** | |
* @var string | |
* | |
* @ORM\Column(name="iconKey", type="string", length=20) | |
*/ | |
private $iconKey; | |
/** | |
* @ORM\OneToMany(targetEntity="FortuneCookie", mappedBy="category") | |
*/ | |
private $fortuneCookies; | |
... lines 43 - 111 | |
} |
... lines 1 - 12 | |
class FortuneCookie | |
{ | |
/** | |
* @var integer | |
* | |
* @ORM\Column(name="id", type="integer") | |
* @ORM\Id | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
private $id; | |
/** | |
* @var Category | |
* | |
* @ORM\ManyToOne(targetEntity="Category", inversedBy="fortuneCookies") | |
* @ORM\JoinColumn(nullable=false) | |
*/ | |
private $category; | |
/** | |
* @var string | |
* | |
* @ORM\Column(name="fortune", type="string", length=255) | |
*/ | |
private $fortune; | |
... lines 38 - 174 | |
} |
With a ManyToOne
relation from FortuneCookie
to the Category
:
... lines 1 - 12 | |
class FortuneCookie | |
{ | |
... lines 15 - 23 | |
/** | |
* @var Category | |
* | |
* @ORM\ManyToOne(targetEntity="Category", inversedBy="fortuneCookies") | |
* @ORM\JoinColumn(nullable=false) | |
*/ | |
private $category; | |
... lines 31 - 174 | |
} |
For our homepage, we're using the entity manager to fetch the Category's
repository and call the built-in findAll
function:
... lines 1 - 10 | |
/** | |
* @Route("/", name="homepage") | |
*/ | |
public function homepageAction() | |
{ | |
$categoryRepository = $this->getDoctrine() | |
->getManager() | |
->getRepository('AppBundle:Category'); | |
$categories = $categoryRepository->findAll(); | |
return $this->render('fortune/homepage.html.twig',[ | |
'categories' => $categories | |
]); | |
} | |
... lines 26 - 47 |
This returns every Category, and so far, it lets us be lazy and avoid writing a custom query. The template loops over these and prints them out. AMAZING.
Time to write a query! One that will order the categories alphabetically.
Call a new method called findAllOrdered()
:
... lines 1 - 13 | |
public function homepageAction() | |
{ | |
$categoryRepository = $this->getDoctrine() | |
->getManager() | |
->getRepository('AppBundle:Category'); | |
$categories = $categoryRepository->findAllOrdered(); | |
... lines 21 - 24 | |
} | |
... lines 26 - 47 |
This needs to live inside the CategoryRepository
class. So create a
public function findAllOrdered()
. To prove things are wired up, put a
die
statement:
... lines 1 - 12 | |
class CategoryRepository extends EntityRepository | |
{ | |
public function findAllOrdered() | |
{ | |
die('this query will blow your mind...'); | |
} | |
} |
Refresh! Sweet, ugly black text - we're hooked up!
Ok, so you're used to writing SQL, maybe MySQL queries. Well, Doctrine speaks a different language: DQL, or Doctrine Query Language. Don't worry though, it's so close to SQL, most of the time you won't notice the difference.
Let's see some DQL. So: $dql = 'SELECT cat FROM AppBundle\Entity\Category cat';
:
... lines 1 - 12 | |
class CategoryRepository extends EntityRepository | |
{ | |
public function findAllOrdered() | |
{ | |
$dql = 'SELECT cat FROM AppBundle\Entity\Category cat'; | |
... lines 18 - 21 | |
} | |
} |
The big DQL difference is that instead of working with tables, you're working
with PHP classes. And that's why we're selecting from the full class name
of our entity. Symfony users are used to saying AppBundle:Category
, but
that's just a shortcut alias - internally it always turns into the full class
name.
The cat
part is an alias, just like SQL. And instead of SELECT *
, you
write the alias - SELECT cat
. This will query for every column. Later,
I'll show you how to query for only some fields.
To run this, we'll create a Query object. Get the EntityManager
, call
createQuery()
and pass it in the DQL. And once we have the Query
object,
we can call execute()
on it:
... lines 1 - 12 | |
class CategoryRepository extends EntityRepository | |
{ | |
public function findAllOrdered() | |
{ | |
$dql = 'SELECT cat FROM AppBundle\Entity\Category cat'; | |
$query = $this->getEntityManager()->createQuery($dql); | |
return $query->execute(); | |
} | |
} |
This will return an array of Category
objects. Doctrine's normal mode
is to always return objects, not an array of data. But we'll change that
later.
Let's query for some fortunes! Refresh the page. Nice - we see the exact same
results - this is what findAll()
was doing in the background.
To add the ORDER BY
, it looks just like SQL. Add ORDER BY
, then cat.name DESC
:
... lines 1 - 14 | |
public function findAllOrdered() | |
{ | |
$dql = 'SELECT cat FROM AppBundle\Entity\Category cat ORDER BY cat.name DESC'; | |
$query = $this->getEntityManager()->createQuery($dql); | |
return $query->execute(); | |
} | |
... lines 23 - 24 |
Refresh! Alphabetical categories! So that's DQL: SQL where you mention class names instead of table names. If you Google for "Doctrine DQL", you can find a lot more in the Doctrine docs, including stuff like joins.
Of course ultimately, Doctrine takes that DQL and turns it into a real
MySQL query, or PostgreSQL of whatever your engine is. Hmm, so could we see
this SQL? Well sure! And it might be useful for debugging. Just var_dump
$query->getSQL()
:
... lines 1 - 14 | |
public function findAllOrdered() | |
{ | |
$dql = 'SELECT cat FROM AppBundle\Entity\Category cat ORDER BY cat.name DESC'; | |
$query = $this->getEntityManager()->createQuery($dql); | |
var_dump($query->getSQL());die; | |
return $query->execute(); | |
} | |
... lines 24 - 25 |
Refresh! It's not terribly pretty, but there it is. For all the coolness, tried-and-true SQL lives behind the scenes. Remove that debug code.
There is also an issue with "hautelook/alice-bundle". I had an error like this during executing "composer install":
"remote: repository not found
fatal: repository 'https://github.com/hautelook/AliceBundle.git/' not found"
Probably something happened with this repository. I fixed this by adding this to composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/theofidry/AliceBundle" } ]
Hey Jakub,
Nice catch! I wonder what command exactly failed for you? That should work even without that VCS URL, so maybe we have a blind spot in this tutorial. Would appreciate if you share your steps to reproduce for that error.
Cheers!
Hi Victor,
As I wrote, composer couldn't install "hautelook/alice-bundle". This alice-bundle probably contains tools for the fixtures (sorry that maybe I'm not very precise but I'm still a begginer). That is why I added some lines to composer.json (see in my previous post) and run 'composer update'. Then, when I thought that everything is OK, I run commands to create database and fixtures and it was still working. Then, I run server, opened app in browser and got this error in 'classes.php' (see my first post). I hope that it would help you to improve this tutrial code and maybe you could help me to run it at last. I will try to switch from php 7.1 to 7.2 and I hope it will help me.
Best regards,
Jakub
Hey Jakub,
Aha, I see now. I updated the lock file in the project code to update the link to a new repository, it should work out of the box now when you download the source code. Thanks for reporting and sharing more info about it!
Cheers!
Hi again Victor,
I managed to workaroud the problem with "declare(strict_types=1)", but the solution I applied isn't perfect (in fact I think it is far away form perfection). My soluction is like this:
If someone would have same issues with this course I hope it will help.
Cheers,
Jakub
Hey Jakub,
Thanks for sharing this tip with others. Yeah, changing cache files is not a robust solution, unfortunately. Hm, what PHP version do you have locally? Also, what OS do you use? I suppose you're on a Windows. That might cause some issues sometimes.. Probably updating dependencies might fix this problem if the problem only in the compiled files. Also, see this StackOverflow post about the error you mentioned, it might be related: https://stackoverflow.com/questions/53376444/getting-fatal-error-while-i-am-trying-to-use-the-declarestrict-types-1-on-my
Cheers!
Hi victor,
my OS is Linux Ubuntu 22.04 LTS. For this app I use PHP 7.2 but I also use ppa:ondrej/php package to switch between different versions of PHP. Anyway, thank you for this stackoverflow link. I'm going to check if it would fit for me.
Hello,
I am going crazy.
I have php 7.2.33 installed.
When I triyed to composer install I get this error
In Process.php line 143:
[TypeError]
Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given, called in C:\go
pro doctrine\vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle\Composer\ScriptHandler.php on line 455
Thank you in advance
Hey zahariastefan462
Sorry for the late response, it seems that there is some incompatibility in Sensio bundle and your composer version. Can you try to downgrade composer to version 1 with composer self-update --1
and try installation process again.
Cheers!
Hi Ryan, I'm very beginner in Symfony! I have 2 questions here:
1-My PHP version is 7.3.24 and this project support PHP version("php": ">=5.3.3, <7.3.0")!
Do I need to downgrade my PHP version or modify composer.json PHP version?
2-I have opened the start project inside The"Go Pro with Doctrine Queries" but below setup is quite unclear to me!
Would you please explain to me what should I do?
Project Setup:
Configure parameters.yml:
Copy app/config/parameters.yml.dist to app/config/parameters.yml and configure any of the database_ options.
Thank you
oh, I see my questions have been already answered below!
So if I understand it correctly, this is quite old project and needs to be upgraded but still good to watch.
Hey Roozbeh,
Good catch! I'm glad you found the answers below by yourself :) If you still have any questions following this course - please, let us know in the comments and we will help you.
> So if I understand it correctly, this is quite old project and needs to be upgraded but still good to watch.
Yes, you're right! There're 2 ways:
1) Downgrade your PHP version to 7.2 for example so that you could follow this course. You can keep the current PHP version you have and try to install an alternative legacy version instead that you will use to follow this tutorial
2) Download the course code, go to start/ directory, and upgrade the dependencies with "composer update" command so that it would support a higher version of PHP, e.g. 7.3 you have installed. But it may require some extra work and if you're a "very beginner" - it might be a bit tricky for you.
So, I'd suggest you to go with the 1st option. Meanwhile, we're going to release an upgraded tutorial for this topic in the future, but unfortunately I don't have any estimations yet when it might be released.
I hope this helps!
Cheers!
Hi, i was wondering if you had an update on your previous reply to Jay. I would love to do this course, but I'm not able to because of the outdated code. Any estimate when an updated course is available? Learning Symfony is not complete without Doctrine Queries
Hey Paul D.!
Yes! We *have* finished sorting out the dependency issues and each tutorial now advertises (when you hover over the download) which versions of PHP it supports. Unfortunately, this tutorial requires PHP 7.2 or lower - we would have to upgrade the dependencies way too much (and potentially causing the code ti start behaving differently than the video) to get support for higher versions.
So, for now, I don't have a great answer - I apologize :/. The content in the video still works - this part of Doctrine has not changed. But, if you want to download the course code and code along, you'll have to do that using PHP 7.2 or lower. I'll talk with the team: we may do an update on this tutorial to extend its life. I agree with you: it's a critical topic.
Cheers!
I cannot get this project started. The starting code gives me an error on composer install
On composer update is the same error.
Here is the stack trace.
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Deprecated: Array and string offset access syntax with curly braces is deprecated in /Users/Jay/Documents/symfony/doctrinepro/start/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php on
line 70
Cannot load Zend OPcache - it was already loaded
PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /Users/Jay/Documents/symfony/doctrinepro/start/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.ph
p on line 70
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Hey James M.!
Bah, sorry about that! You're totally right - the problem happens with PHP 7.3 and 7.4. Basically, when those versions of PHP came out, there we some slight changes that caused breakages in some of our dependencies. This caught us a bit by surprise, and we're still putting systems into place to catch this and fix existing tutorials. We've also updated the dependencies for many tutorials to bring in newer versions that work with PHP 7.3 and 7.4.
In this case, this tutorial is (unfortunately) quite old - so old that we can't update its dependencies without making *major* changes :/. The reason the tutorial is old is that the Doctrine query logic hasn't changed in awhile - so there wasn't a good reason to update. But, this has forced our hand. Unfortunately, for the few tutorials that are in this situation, we're still catching up with wither (A) re-recording them or (B) at least communicating the PHP incompatibilities.
That's a LONG way of saying (A) you're right and (B) it's our fault. We're working to make this *not* a problem (and very transparent where it is a problem), but that's ongoing. My apologies! For this tutorial, the only solution currently is to use PHP 7.2 or lower, unfortunately. Or you can "steal" the code and put it into a newer project - I'd be happy to help if you have any issues.
Cheers!
Is there a way to see the full sql with parametres of doctrine query in command(ContainerAwareCommand), something like queries in profiler ?
Hey Helmi
There are two ways you can see your queries being executed:
1) Activate MySql logging. It will slow down your application but for dev purposes it should be good enough - https://stackoverflow.com/a/304008
2) Run your commands passing in -vvv
flag.
Cheers!
Hi!
When i run composer install after i setup the parameter.yml I get the following error.
And i don't get why i get this error because i just followed the README
Hey Emin,
Hm, could take a look at this thread? https://symfonycasts.com/sc...
Does it help you to fix this problem?
UPD: Or you know what, just try to run "composer update" first. Actually, I had the similar error for this course and "composer update" helped me. I also pushed changes, so when you download this course again it will contain updated dependencies and this error should be gone.
Cheers!
Hey Victor,
Thank you for the fast reply.
When I redownload the course code i get the same error. And when I i run composer update i get the following error.
So i think i made it worse. And i have the same problem with the Ansible course.
Kind regards
Emin
Hey Emin,
Oh, interesting... I did it yesterday and it worked perfect for me. Let's try to figure it out. What PHP version do you have?
Cheers!
Hey Emin,
Aha, I tested it on PHP 7.2. So, the problem in PHP 7.3. Actually, if you google this error message - you will see some search results for PHP 7.3. So, there're a few possible solutions:
- You can downgrade your PHP version to 7.2
- Or try to debug further and find the problem in code. If it's a custom code - you can easily fix the problem, but if it's a code in vendor/ directory - you can try to upgrade related dependency to the latest version. But sometimes in order to do so - you need to upgrade more related dependencies that's not an easy task and may require some changes in the code. It looks related to Doctrine, see these issues:
- https://github.com/symfony/...
- https://github.com/doctrine...
So I can recommend you to try to upgrade Doctrine ORM first to the latest available version, it should fix the problem.
This tutorial is kinda old already, so it may not work on the latest version of PHP, because 7.3 was released less than month ago.
Cheers!
Hey Victor,
thank you for the help men bij downgrading to php 7.2 it works now i don't get the error anymore. But i still want to try to make it work on php 7.3 but for now i will keep it at php 7.2.
Cheer!
Hey Emin,
Glad it works! Yeah, totally agree, downgrading PHP versions is a bummer! So, when you're ready - try to upgrade dependencies to the latest versions, we lock minor/major versions in composer.json so you can upgrade easily without BC breaks. But you can manually tweak those minor/major version constraints to allow upgrading to the latest available version, but you probably also will need to do some changes in the project.
Or you can create a totally new project on the latest Symfony and try to follow this tutorial on it. Well, you would probably need to add some code, but most of it is just a copy/paste from the downloaded code I think.
Cheers!
Hi guys!
I have a problem with the course code and its installation.
Fatal error: require_once(): Failed opening required 'C:\OpenServer\domains\startdoc\app/bootstrap.php.cache' (include_path='.;c:/openserver/modules/php/PHP-7.0-x64;c:/openserver/modules/php/PHP-7.0-x64/PEAR/pear') in C:\OpenServer\domains\startdoc\app\console on line 10
How can I fix this error?
Is there a PHPStorm plugin that helps me with my DQL queries? It looks like it's interpreting it as regular SQL which is not helping very much :)
Hey Johan,
Use the same Symfony plugin for PhpStorm - it should help with it a bit, at least it helps with doctrine query builders.
Cheers!
Ye I noticed :)
It does not help with DQL queries, but indeed it helps with the query builders which I will probably be using most of the time.
Thanks Victor!
Hello
After configuring paramaters.yml and installing composer, I am unable to start the server or create the database. The error message is:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: A non-numeric value encountered
I should note: Before this course I was going through the Symfony 3 path and I believe this course is in Symfony2. So I suspect that may be part of the problem. Any help getting passed this issue would be greatly appreciated.
Dank
Hey @John
You are correct, this project runs on Symfony 2.6. I believe that error you are getting is related to an incompatibility between Symfony2 and PHP7. You are on PHP7, right?
Hmm, try updating your dependencies "$ composer update"
Cheers!
Hi guys!
I have a problem with the course code and its installation through terminal in ubuntu!
I follow the instructions of readme file and i got these errors when i tried to run "php composer.phar update
":
1) [Doctrine\Common\Annotations\AnnotationException]
You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.
2) Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
3) [RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
i changed the composer.json as you suggest from this link https://github.com/symfony/...
Now i have the following errors:
1) Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
(didn t change from the previous time)
2) [RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Class 'Symfony\Component\HttpKernel\Kernel' not found in
/home/projects_linux/queries1/app/AppKernel.php on line 6
(these is like the previous but with the AppKernel problem that i have it when i try to use database:create)
Do you know how can i fix it?
Thanks in advanced!!
Hey argy_13
For point 1): You have to locate your "php.ini" file, run in a terminal "$ php -i", then open it and activate your opcache or zend_optimize (it depends which one you are using), if you are using opcache, you just have to add this two lines to your file:
opcache.enable=1
opcache.load_comments=1
If for some reason you have more troubles doing it, you can follow this guide: http://www.hostingadvice.com/how-to/enable-php-5-5-opcache-ubuntu-14-04/
I believe this should fix your whole problem, but if not, try updating "distribution-bundle" by running:
$ composer update sensio/distribution-bundle
I hope it fix your problem, have a nice day!
Thanks for your immediate reply Diego!
Unfortunately, this didn t help me, but because i m using symfony 3 (i am new in this) i found the solution here...
https://stackoverflow.com/q...
so instead of running to the terminal the command that you write in readme file of the course
"php composer.phar install" because it gives me many exceptions
i run the command from the second answer
"composer require doctrine/annotations" and i didn t have none problem!
p.s. of course i reinstall everything from scratch!
But also thank you again for your answer and keep up the wonderful work that you re doing!
Hi guys:
I try to load fixture to 3.1 since this is 2.6. but I am having troubles
Errors message:
[UnexpectedValueException]
Could not determine how to assign category_id to a AppBundle\Entity\FortuneCookie object
Here is my fixtures.yml
AppBundle\Entity\Category:
category_{1..10}:
name: <name()>
iconKey: <name()>
AppBundle\Entity\FortuneCookie:
fortuneCookie_{1..10}:
category_id: '@category_*'
fortune: <sentence()>
createdAt: <dateTimeBetween(now)>
numberPrinted: <numberBetween(1,10)>
discontinued: <numberBetween(1,10)>
here is my LoadFixture.php
namespace AppBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Nelmio\Alice\Fixtures;
class LoadFixture implements FixtureInterface
{
public function load(ObjectManager $manager)
{
Fixtures::load(__DIR__.'/fixtures.yml', $manager);
}
}
Hey Jian,
Looks like you're trying to assign category to nonexistent property category_id
, use category
instead:
AppBundle\Entity\FortuneCookie:
fortuneCookie_{1..10}:
category: '@category_*'
Let me know if you still have this error.
Cheers!
Ya..category works. But I have create a category_id field and setter inside my Entity. would that works? Or I better off stick with category object instead?
Hey Jian,
The coolness here is that you don't need to add "category_id" - you operate objects. Since Category is object and you create this type of objects with Alice - you just may set it below for your FortuneCookie entity and Alice make everything for you, i.e. set the whole Category object with FortuneCookie::setCategory(). Of course, you need FortuneCookie::setCategory() setter to make it possible.
Cheers!
Hello
Please, can your tell me we why dump() query looks like:
string(105) "SELECT c0_.id AS id0, c0_.name AS name1, c0_.iconKey AS iconKey2 FROM category c0_ ORDER BY c0_.name DESC"
what mean "c0_.id AS id0"?
what is "c0_"?
why it is written this " c0_.name AS name1"?
why dump() query:
$dql = 'SELECT cat FROM AppBundle\Entity\Category cat ORDER BY cat.name DESC';
Doesn't look like for example:
'SELECT id, name, iconKey FROM ORDER BY name DESC'; ?
Hey Nina,
It's something related to SQL knowledges, i.e. in your example "category c0_" means creating an alias "c0_" for "category" table. So now I can refer to this table by its short alias "c0_" where "c" is the first letter of real table name, and "0" just means an index. If you have a joins, you'll see that tables have different indexes and it makes sense, because you may have table names that start with the same latter like "posts", "products", etc. The same for column names like c0_.name AS name1 where name1 is the field alias. So with these aliases Doctrine reduces the query length - probably not too much important, but I suppose in this way it's easier to transform query builder into raw SQL queries. Actually, it comes from Doctrine internals.
So in shorts, Doctrine uses SQL aliases because it's a good practice to use them and because it's easier to automate transformation of query builder into raw SQL queries. And probably you won't need to see those raw SQL queries, maybe just for debugging, but it's really rare case.
Cheers!
Hey William D.
Yes, you can use some of them like COUNT(), etc. but most of them are unavailable out of the box. However, with third-party packages you can add support for more native SQL functions, for example, see https://github.com/beberlei... for more information.
Cheers!
Hi Ryan,
it seems you are using symfony 2.6 for this tutorial. I just watched all of your symfony 3 tutorials and started coding in symfony3, is there a way to use symfony 3 in this project too? I don't suppose change "symfony/symfony": "2.6.*" in composer.json to "symfony/symfony": "3.1.*" will do the trick?
// composer.json
{
"require": {
"php": ">=5.3.3, <7.3.0",
"symfony/symfony": "2.6.*", // v2.6.13
"doctrine/orm": "~2.2,>=2.2.3", // v2.4.8
"doctrine/doctrine-bundle": "~1.2", // 1.6.4
"twig/extensions": "~1.0", // v1.5.4
"symfony/assetic-bundle": "~2.3", // v2.8.2
"symfony/swiftmailer-bundle": "~2.3", // v2.3.12
"symfony/monolog-bundle": "~2.4", // v2.12.1
"sensio/distribution-bundle": "~3.0.12", // v3.0.36
"sensio/framework-extra-bundle": "~3.0", // v3.0.29
"incenteev/composer-parameter-handler": "~2.0", // v2.1.3
"hautelook/alice-bundle": "0.2.*" // 0.2
},
"require-dev": {
"sensio/generator-bundle": "~2.3" // v2.5.3
}
}
Hi,
when I run app in the browser, I have this kind of error:
"FatalErrorException in classes.php line 6706:
Compile Error: strict_types declaration must be the very first statement in the script"
This file "classes.php" is from "./app/cache/dev/" directory. I don't know what to do with this. I tried to put "declare(strict_types=1);" in first line of this file but it doesn't help.
I'm using php 7.1 for this app.
Maybe someone had this kind of problem and could help me.
Jakub