Edit the make:entity command - doctrine-orm

I would like to edit the make:entity command provided by the MakerBundle in Symfony 4.
Here is an explaination : the command adds the field Id by default in each entity. I would like automatically add other fields. That is why I want to edit the make:entity command.
I can also create a new Bundle that adds a new command like my:make:entity. But if I add a new command, I don't want that make:entity still usable anymore. I have an OpenSource project and I don't want somemone to use the old make:entity command. So, if I can't edit the make:entity command, can I deactivate it ?
Thank you in advance,
Vincent

You can fork the github repository from :
https://github.com/symfony/maker-bundle
and then make any modifications you like, commit and push to your fork.
Then you need to tell composer to use your fork instead of the official repo by adding a "repositories" section to the end of your composer.json file
"repositories": [
{
"type": "vcs",
"url": "https://github.com/[your github]/maker-bundle"
}
],
I hope this helps.

Related

QT installer framework - How to add a custom script after online update execution

Can I add some code after the maintance tool update execution(or after the final page)?
Basically I have an application that is already in use. It has a setuped QT Installer Framework autoupdates. And I need to execute a script right after a new update will be installed. But that script does not exist yet in the current installed version - it will be added by that update.
I have a class UpdateManager.cpp:
// ... Manually check for updates ...
// ...
arguments << "--script=installer-noninteractive.qs";
QProcess::startDetached("./uninstall", arguments);
// Quit the app
Where the installer-noninteractive.qs is done using this official guide
As I got the only entrypoint for me to interupt the end of update is this script. But when the maintaince tool is running it basically has an old version of script, because it will be downloaded after.

How can I change the colour theme for Apache Superset

I am deploying superset for my company and required to change the theme to blue. I have tried to follow the guide from https://debaatobiee.wordpress.com/2019/08/04/customizing-apache-superset-ui-config-theme-changes/ but still unsuccessful.
I have few questions in mind:-
1. Do we need to rebuild superset after amended variable.less?
2. If rebuild is required, if I upgraded to latest version in future, do I required to rebuild it again?
Starting from Superset 1.1.0 it is possible to customize theme via the THEME_OVERRIDES in superset_config.py configuration file.
THEME_OVERRIDES = {
"borderRadius": 4,
"colors": {
"primary": {
"base": 'red'
},
"secondary": {
"base": 'green'
},
"grayscale": {
"base": 'orange'
}
}
}
The default theme values can be found in index.tsx file.
Please note that according to the given GitHub issue the structure of this configuration property is a subject for change and might be modified in the further Superset releases.
You can make use of the docker version once you have made the changes. Use the docker-compose build command to create the new image.
1) Yes, you need to rebuild once you make changes
2) Yes, since you have a custom version, for every upgrade, you have to update the original files with your custom files and rebuild

How can I call Django's manage.py from GNOME Builder?

I have GNOME Builder installed on 3.24.1 installed on Ubuntu 17.04. I have a functional Django project and an associated virtualenv. (Django 1.11, Python 3)
How can I configure Builder, so that when I click Run it invokes manage.py runserver in the virtualenv? (Ideally I'd like to be able to run other manage.py functions too, like manage.py collectstatic.)
This is not really possible as Gnome-Builder works tightly integrated with flatpak. As far as I know the "hostsystem buildsystem" only supports auto detected run targets and only one of those.
However if you create a flatpak json manifest you can set the command to be run in the command variable of the json manifest - though probably not everything you want. As this means the application runs in a flatpak sandbox.
Setup
To do that you can create a new python gnome application with gnome-builder called djangoproj. This will generate a Project that uses the meson buildsystem and a org.gnome.djangoproj.json. The next thing would be to remove the gnome application - or you just ignore it and add your Django dependencies.
Add the required modules before the native modules. For just Django this is:
[…]
"modules" : [
{
"name": "python3-Django",
"buildsystem": "simple",
"build-commands": [
"pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} Django"
],
"sources": [
{
"type": "file",
"url": "https://pypi.python.org/packages/1b/50/4cdc62fc0753595fc16c8f722a89740f487c6e5670c644eb8983946777be/pytz-2018.3.tar.gz",
"sha256": "410bcd1d6409026fbaa65d9ed33bf6dd8b1e94a499e32168acfc7b332e4095c0"
},
{
"type": "file",
"url": "https://pypi.python.org/packages/54/59/4987ae4a4a8be8507af1b213e75a449c05939ab1e0f62b5e90ccea2b51c3/Django-2.0.3.tar.gz",
"sha256": "769f212ffd5762f72c764fa648fca3b7f7dd4ec27407198b68e7c4abf4609fd0"
}
]
},
{
"name" : "djangoproj",
"buildsystem" : "meson",
[…]
If you have additional dependencies there is a handy tool to generate the necessary json lines: https://github.com/flatpak/flatpak-builder-tools/tree/master/pip
Now you can add the Django project files using the host system.
django-admin startproject sample
Meson needs to know about the new files so just add subdir('sample') to the root meson directory and create new meson files in the subdirectories. The meson.build in the sample directory looks like this for me. for the sample/sample directory you'd need to adjust the moduledir and the djangoproj_sources
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'djangoproj')
python3 = import('python3')
conf = configuration_data()
conf.set('PYTHON', python3.find_python().path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)
subdir('sample')
djangoproj_sources = [
'manage.py',
]
install_data(djangoproj_sources, install_dir: moduledir)
Now you can set the command in the org.gnome.Djangoproj.json to bash and after pressing launch in the window where otherwise the logs of the program appear there is an interactive shell. There you can explore your newly created flatpak with Django included in the /app/ directory. If you want to run the Django app you'd do:
$ python3 /app/share/djangoproj2/djangoproj2/manage.py runserver
you can also write this command in the command variable of the json file to launch it directly when pressing the "play"-button.
All the other commands do work too- however keep in mind that the environment is in a flatpak and recreated on every rebuild... So nothing that needs to persist can be saved in the flatpak directory.

Running Calabash Android from Rubymine

Can someone post some help. I have tried different config but can't run Calabash Android tests from within Rubymine. Works on Terminal though.
Finally found the solution after some trial and error. Here is what you need to do on Rubymine:
EDIT Runner Options and add: APP_PATH= "" and TEST_APP_PATH="" and run the feature file. This should do it.
Thanks,
Method, suggested by Manpreet Singh, uses cucumber as the test runner. Here you need to define APP_PATH and TEST_APP_PATH environmental variables:
APP_PATH will need to be reset if apk file or file name changes (e.g. uploaded a new version of the apk)
TEST_APP_PATH points to the test server file, which is generated by calabash when you try to connect calabash to your new apk for the first time (e.g. with "calabash-android run" or "calabash-android console"), or if previous test server file was deleted
This way it's easier to create a new test using "Right-click on a scenario or feature file > Create configuration" in RubyMine thanks to its robust cucumber support
Another method is, as pointed by Dave, to set up a calabash-android run as a gem executable - see this thread for details.
Need to set apk path only
This way, your execution is the same as in the command line and passing arguments (such as cucumber profile, output options etc) will work for sure. Also, such configuration is less fragile to the test_server change. However, it's a bit more cobersome to setup than as a cucumber run.
After all with the current architecture of calabash, I still prefer to code in IDE but run in the command line :) IDE becomes very useful, when you need to debug tests.
the setting above does not work for me
here is the setting worked. basically, in Run/Debug configureation, need to create a Gem command to execute calabash-android, and correct arguments, not a configure for Cucumber .
http://daedalus359.wordpress.com/2013/11/02/getting-calabash-to-play-nicely-with-rubymine/
-dave

install DoctrineFixturesBundle and doctrine-fixtures in Symfony 2.1.4

I want to install and configure DoctrineFixturesBundle and doctrine-fixtures in Symfony 2.1.4. Can anyone give me a guide.
Your question may be already in answered in DoctrineFixturesBundle issues section, anyway I will summarize the steps to install and configure DoctrineFixturesBundle in symfony 2.1.4 version.
Step 1 :
Open the composer.json and append below code in require section. This file is located in root folder of the project
{
"require": {
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/data-fixtures": "dev-master"
}
}
Step 2:
Run below command in your terminal
php composer.phar update
Final Step:
append the below in your app/AppKernel.php
// ...
public function registerBundles()
{
$bundles = array(
// ...
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
// ...
);
// ...
}
Hope it helps.