Select Page

WE IMPROVE YOUR BUSINESS

Direct support nodig bel: 056-4654561 of ga naar support

### vagrant

sudo vagrant plugin install vagrant-cachier
vagrant up
vagrant ssh
vagrant provision

### generate

sudo php bin/console doctrine:generate:entity AppBundle:Company

sudo php bin/console doctrine:generate:entities AppBundle/Entity/Import
sudo php bin/console doctrine:generate:crud –no-interaction –entity=AppBundle:File
php bin/console generate:doctrine:form AppBundle:File
php bin/console sg:datatable:generate AppBundle:File

### ansible

### deployment

## new ssh key for rsync and github

ssh-keygen -t rsa -b 4096

ssh-add ~/.ssh/4bis5_rsa

ssh-copy-id -i ~/.ssh/4bis5_rsa.pub root@84.22.110.234

ssh 4bis5.4bis.nl

### Clear DB structure

php bin/console –env=dev doctrine:schema:drop –full-database –force

Shared Bundles

166down voteaccepted

Create a new empty symfony project

php composer.phar create-project symfony/framework-standard-edition demo/ 2.4.1
cd demo

Generate a new bundle

(for example src/Company/DemoBundle)

php app/console generate:bundle
cd src/Company/DemoBundle/

Init your github repository in src/Company/DemoBundle

git init
touch README.md
git add .
git commit -m "initial commit"
git remote add origin https://github.com/YourAccount/DemoBundle.git
git push -u origin master

Add a composer.json file

src/Company/DemoBundle/composer.json:

{
    "name" : "company/demobundle",
    "description" : "A demo bundle",
    "type" : "symfony-bundle",
    "authors" : [{
        "name" : "demo",
        "email" : "demo@company.com"
    }],
    "keywords" : [
        "demo bundle"
    ],
    "license" : [
        "MIT"
    ],
    "require" : {
    },
    "autoload" : {
        "psr-0" : {
            "Company\\DemoBundle" : ""
        }
    },
    "target-dir" : "Company/DemoBundle",
    "repositories" : [{
    }],
    "extra" : {
    "branch-alias" : {
            "dev-master" : "some_version-dev"
        }
    }
}

Now you have the base structure of your bundle

Use it in another project

composer.json:

    [...]
    "require" : {
        [...]
        "company/demobundle" : "dev-master"
    },
    "repositories" : [{
        "type" : "vcs",
        "url" : "https://github.com/Company/DemoBundle.git"
    }],
    [...]

Do:

curl -sS https://getcomposer.org/installer | php
php composer.phar update company/demobundle

app/AppKernel:

new Company\DemoBundle\CompanyDemoBundle(),

Work on it

  • You can clone your DemoBundle in the src/Company folder, then manually install it
  • You can use symlink

Conclusion

You can develop and test your bundle in your first project and use it with github and composer in your second project.

##### Create fixtures
# the lib https://github.com/Webonaute/DoctrineFixturesGeneratorBundle/blob/master/Resources/doc/index.md

php bin/console doctrine:generate:fixture –entity=AppBundle:Block –name=”AppBundleEntityBlock”

##### load fixtures

php bin/console doctrine:fixtures:load
php bin/console doctrine:fixtures:load –fixtures=src/AppBundle/DataFixtures/ORM/LoadPowerUsageData.php –append

php bin/console doctrine:generate:fixture --entity=AppBundle:Blocks --name="blocks" --order="1"

xdebug

sudo vi /etc/php/7.2/fpm/conf.d/20-xdebug.ini
##
xdebug.remote_enable=true
xdebug.remote_connect_back=true
##
sudo service php7.2-fpm restart
####

### Deployer

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

eval "$(ssh-agent -s)"

sudo ssh-add -l

sudo ssh-add ~/.ssh/id_rsa_admin_ifinish_github

php vendor/bin/dep deploy:unlock production -vvv php vendor/bin/dep deploy:unlock production -vvv php vendor/bin/dep deploy production -vvv