When I was creating projects in Symfony2 on Windows there were no problems, but now (linux) I got something like this:
when I want to generate bundle without any parameters I get
[RuntimeException]
The "namespace" option must be provided.
When I type in the namespace I get:
[RuntimeException]
The "dir" option must be provided.
I can create bundle only if I give all the necessary arguments at the beginning and I'm kinda lazy person and it's quite annoying for me that console doesn't ask about namespace or anything. Is there any chance to repair this?:P
EDIT: actually this happens whenever I try to run function which requires arguments.
I've tried too to create a bundle with Netbeans or Eclipse but i have encountered the same problem.
The unique solution is to create your bundle with the Terminal.
All the process will run normally, and you'll only to answer the questions for finish your creation.
I'll come back to you if i've other solutions.
Cordially.
your problem doesn't come from netbeans, I use phpstorm and I had the same problem.
later I found out that the problem comes from symfony to solve it go to your project folder for me it was like:
/opt/lampp/htdocs/MyProject/vendor/symfony/symfony/src/Symfony/Component/console and open file Application.php in a text editor
search for
$input->setInteractive(false);
then comment it like this :
//$input->setInteractive(false);
it should perfectly work now !
Related
I like to develop a fresh Joomla Component for Joomla 3.x in Eclipse and created therefore a simple PHP project.
The problem I have is now how to setup the correct "include path", so that the basic Joomla PHP classes get found like "JFactory" , "JAccess", "JObject" ...
If I just include a Joomla installation in my include path, this will not work. I assume the paths to the classes are more sophisticated than that.
Any Idea or suggestion how the "include path" for my project should look like?
regards
Mark
It depends a little on what you mean by "found".
If you mean "as I start typing a basic class name every matching basic class gets offered as an option", yes, there is a way to do that.
See the conversation, and solution, on this gitHub page.
I have the stub file referred to and it works in the way I've said above, tho' I'm using NetBeans not Eclipse (but the reference to phpStorm makes me think it should/could work for you too), although I haven't been able to run the build script. I just haven't got the time to single step through it to find out where it stops.
I just started with Symfony framework this afternoon. I moved onto "CRUD" and was following a tutorial to use the tools built in to generate the CRUD. However, using the default commands, I am getting errors.
Attempted to load class "Task" from namespace "AppBundle\Controller".
Did you forget a "use" statement for another namespace?
500 Internal Server Error - ClassNotFoundException
This is the video I was following.
I started with a blank installation of Symfony.
Connected the database.
Ran php bin/console generate:doctrine:entity, wrote
AppBundle:Tasks, and pressed enter through all options defaults to
create a simple name and notes field.
Ran php bin/console generate:doctrine:crud wrote AppBundle:Tasks, and pressed enter through all option defaults but selecting yes for generating all the CRUD commands
Ran php bin/console doctrine:schema:update --force
Ran php bin/console cache:clear
Go to //localhost/symfony/web/app_dev.php/tasks and I'm brought to the list, works fine.
But if I go to localhost/symfony/web/app_dev.php/tasks/new or click the generated button, I get the error mentioned above.
The error message is greek to me, despite its best attempts to be polite. I can see there is a Tasks.php file under Entity and it defines the class "Tasks" and the TasksController is set to use AppBundle\Entity\Tasks so I have no idea why it is not working with my limited understanding of all this.
I'm trying to build a fairly simple Task Management app but am completely new to Symfony and do not have a solid background in PHP to begin with. Could someone please explain where in the process I may have gone awry?
Things to check:
The name of the file Task.php is the same than the class name class Task. Note: a class should not be in plurial, so Task is right et Tasks is wrong
You have a use AppBundle\Entity\Task; between your Controller namespace and class declaration
To avoid this error, you could use a PHP IDE like Phpstorm (or other), it display your statement in color when you forget to add a use statement.It also add it automatically :D
Hello, I wanted to try creating a Laravel Application and I am really new to this.
I tried all the best I can to analyze and implement the solutions of other people but to no success.
So I have followed the methods in configuring the Laravel App.
The ssh key has also been created in the homekey file as seen from the Homestead.yaml file, I edited it.
But when I try to do 'vagrant up'.
This error message begin to show.
It seems looking for the directory of .homestead but even I can't find it.
I don't know what step am I overlooking.
I am learning Laravel. With composer i included the mobile-detect-bundle in the installation (files are in the folders). When i use the code as stated in the docs on github
$mobileDetector = $this->get('mobile_detect.mobile_detector');
i get this error:
**ErrorException**
File does not exist at path mobile_detect.mobile_detector (View: ) (View: )
I use this in my blade view and i think i have to set the path of 'mobile_detect.mobile_detector' but i have no clue what it has to be. Maybe one can give me a push in the right direction?
The reason it's not working is because you are trying to use a Symfony 2 bundle inside Laravel right out of the box.
As the github page says:
Symfony2 bundle for detect mobile devices, manage mobile view and redirect to the mobile and tablet version.
Basically, the line that you are trying to run is the way that you use services inside Symfony. It will work if you are in a Symfony application, but not inside Laravel.
// Get the mobile_detect.mobile_detector
// service from Symfony's service container
$mobileDetector = $this->get('mobile_detect.mobile_detector');
Although there might be some way to make it work, I'd sugggest to search in packagist for a Laravel specific package, or a PHP generic one that provides the same functionality, to make your life easier.
I've made a search and found this one, which is based in Mobile Detect too:
https://github.com/jenssegers/Laravel-Agent
I'm having a problem with FuelPHP failing to autoload classes. On my staging server (Ubuntu, PHP 5.3.10) it is unable to find custom classes in the fuel/app/classes directory, and it also can't run oil test (I get the error message sh: 1: phpunit: not found). Oddly, it works fine on my local development version (Windows, PHP 5.3.6).
I suspected it might have something to do with Composer, which I'm using for the first time on this project, but the problem is not fixed when I comment out the line require APPPATH.'vendor/autoload.php'; from bootstrap.php (the app still fails to load custom classes from fuel/app/classes)
I'm stumped: I've used FuelPHP on lots of projects and have never had any problems with the Autoloader. What's particularly puzzling is that the same code seems to work fine in one place and not in another. I'd be very grateful for any suggestions about how to fix this.
I realize this question was asked a long time ago, but I had the same problem, so for the benefit of anyone else with this problem, here is what worked for me:
create a new php file called oil.php in the app/config directory with the following code:
<?php
// Unit tests will get shell error 'phpunit: command not found' unless
// the path to php unit is specified.
return array (
'phpunit' => array (
'binary_path' => 'fuel/vendor/bin/phpunit',
),
);
I am using fuel 1.7.2. More information can be found here.
Although the above code fixed the specific PHPunit problems, I still had issues with Fuel and autoloaders not working. Fuel PHP does not follow psr-4 (many of the core fuel files have multiple class definitions in the same file), which can cause problems with certain autoloaders.