Created
September 28, 2014 07:46
-
-
Save richlloydmiles/3d8086f5fcb226e75f90 to your computer and use it in GitHub Desktop.
Symfony2 tutorial notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add object to db via doctrine | |
use Yoda\EventBundle\Entity\Event; | |
$event= new Event(); | |
$event->setName('Richard'); | |
$event->setLocation('DeathStar'); | |
$event->setTime(new \DateTime('tomorrow noon')); | |
$event->setDetails('HA!, Darth Hates suprises'); | |
$em = $container->get('doctrine')->getManager(); | |
$em->persist($event); | |
$em->flush(); | |
Console | |
php app/console | |
start php server php app/console server:run | |
list routes: php app/console router:debug | |
create database: php app/console doctrine:database:create | |
drop database: php app/console doctrine:database:drop | |
generate bundle: php app/console generate:bundle | |
namespace - {Company/Project}/{bundle-name}Bundle | |
enter default for the rest except yml | |
generate doctrine: php doctrine:generate:entity - enter bundle:name | |
{BundleName}:{new name of class that will go in bundle} | |
say yes to repo class | |
generate crud: php app/console doctrine:generate:crud | |
{bundle}/{class} | |
yes | |
yml | |
mapping tables and config : app/console doctrine:schema:create | |
app/console assets:install web --symlink (or --help) | |
compare changes to db : app/console doctrine:schema:update --dump-sql | |
force changes to db : app/console doctrine:schema:update --force | |
clear cache: app/console cache:cleaer --env=prod | |
for null value : * @ORM\Column(name="details", type="text", nullable=true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment