I've acted in accordance with this guid Link.
Then, I created Repos.php file in /app/extensions/command/ And run li3 in command line but do not see the following message:
COMMANDS via app
repos
I see the following text only:
Lithium console started in the development environment. Use the --env=environment key to alter this.
COMMANDS via lithium
create
The `create` command allows you to rapidly develop your models, views, controllers, and tests
by generating the minimum code necessary to test and run your application.
g11n
The `G11n` set of commands deals with the extraction and merging of message templates.
help
Get information about a particular class including methods, properties,
and descriptions.
route
The route command lets you inspect your routes and issue requests against the router.
test
Runs a given set of tests and outputs the results.
See `li3 help COMMAND` for more information on a specific command.
Have I done something wrong?
Related
A while ago i was tasked to program a Typo3 extension to write so called .conf files for the icinga2 montoring tool (has nothing to do with Typo3). Still let me explain some parts of it: Basically the backend user needs to create records of records of specific classes and set values for each records properties. Then i need to process the records to create these .conf files with the specific values with a php script.
I was tasked to use the scheduler in Typo3 for this. And here come the problems: How do i use this? I checked the documentation (https://docs.typo3.org/typo3cms/extensions/scheduler/Introduction/Index.html), but i still can't wrap my head around how to use it for my task. I can easily write an Action in a controller of a class to be executed in the frontend and in turn generate the con files... basically manually without the scheduler. But where do i put my php code to be run by the scheduler? I somehow seem not to understand the basical principle of the scheduler. Can i just run an Action of a specific controller of a class of my extension like i would in the Frontend via the scheduler?
I would suggest you use a command controller for this task.
The documentation shows how to create a command controller, which also may accept arguments.
Command controller tasks can directly be executed by TYPO3 scheduler (see screenshot below)
You may even configure task arguments for command controller tasks in TYPO3 scheduler.
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
This is just a general question, how does Laravel Artisan able to create proper .php file e.g. make:controller with the correct formatting and line breaks?
Is there a good PHP script which can help one develop similar php codes.
Thanks
Ultimately, Artisan relies on Shell scripts included with Laravel. Which are written in the language of Shell and reside in files ending with the extension .sh. Here is a website that contains more explanation of what those are and how to develop them: https://www.shellscript.sh/ If this is ever unavailable simply searching "How to create a shell script" will get you the answer.
PHP can execute these scripts, for example, when you visit that PHP page in your browser, or you trigger it from the command line, assuming you have PHP installed on your server.
Artisan, is custom built to allow you to extend it with more commands, and there are tutorials available to show you how to do that, but it's a completely separate process from creating custom shell commands.
PHP files are just text files, you can easily create them with any language. Also in Laravel usually used so called stubs, templates for classes like migrations, controllers etc.
Just go and look how as Laravel does that under the hood.
I have an application with a Symfony Console based CLI. The application does not use the Symfony framework, just the Symfony Console component.
When I execute
php app/myapp
I get the usual overview with the name, version, options and registered commands shown. Suppose I just have one command, called "displaykittens". What I want to be able to do is
php app/myapp d <TAB>
And have it complete to
php app/myapp displaykittens
As is kinda expected in a modern unix environment. Unfortunately there appears to be no tab completion whatsoever. The Console Component itself provides an utility that allows doing something along these lines in commands themselves. That does not help me with getting tab completion for the commands though. Is this possible somehow?
You might like this extension https://github.com/stecman/symfony-console-completion
It allows you to set up both active commands and our own suggestions
Symfony 5.4+ has autocompletion natively.
You can get more information about autocompletion with bin/console completion --help.
For example with bash you can add this in your ~/.bashrc.
eval "$(/var/www/app/bin/console completion bash)"
Official announcement: https://symfony.com/blog/new-in-symfony-5-4-console-autocompletion
I don't know if it is possible with the normal bash shell. But if you use zsh you can install oh-my-zsh. There is a great plugin that does exactly what you ask for: Oh-My-ZSH Symfony2 plugin
The Application class of the Console component can be wrapped in a Shell class, provided by the same component. That provides some amount of auto completion.
According to people on the #symfony IRC on freenode, there is no way to have the console app provide autocompletion out of the box, since changes to the shell config need to be made.
I'm using php-codeigniter framework and to perform unit-test I use simple-test framework.
Simple-test generates an xml report which is stored in a file while running test cases. Both the application and test-files are committed in jenkins.
Whenever I perform a commit I need unit_test.php to be run automatically and based on the xml file output the build should be generated.
Is there a possible way for it......?
You can start with the PHP templates for jenkins.
You will need to setup Apache Ant on your CI box and configure the xml template to run the differents metric you want, like phpUnit, phpLOC, phpMD, phpCPD, etc.
Based on the output on each metric, you can then flag if the build fail, pass or just keep the metric for further references.
For simple-test, you might have to dig a bit further since its not a documented procedure here is a link