curl -s https://getcomposer.org/installer | php
php composer.phar create-project symfony/framework-standard-edition /home/daryush/public_html/pai-presentation/Symfony 2.1.6
sudo setfacl -R -m u:www-data:rwx -m u:whoami
:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:whoami
:rwx app/cache app/logs
root root pai
php app/console doctrine:database:create
% zmontować projekt
% struktura projektu
php app/console generate:bundle --namespace=PAI/BlogBundle --format=yml
% pokazac utworzonego bundla i AppKernel
% tworzymy klase wpisu php app/console doctrine:generate:entity --entity="PAIBlogBundle:Post" --fields="title:string(255) content:text" php app/console doctrine:generate:entity --entity="PAIBlogBundle:Comment" --fields="comment:text"
% tworzymy akcje kontrolera i template'y dla standardowych akcji php app/console generate:doctrine:crud --entity="PAIBlogBundle:Post" --format="yml" php app/console generate:doctrine:crud --entity="PAIBlogBundle:Comment" --format="yml"
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\OneToMany(targetEntity="Comment", mappedBy="post")
*/
protected $comments;
public function __construct()
{
$this->comments = new ArrayCollection();
}
/**
* @ORM\ManyToOne(targetEntity="Post", inversedBy="comments")
* @ORM\JoinColumn(name="post_id", referencedColumnName="id")
*/
protected $post;
php app/console doctrine:generate:entities PAI
php app/console doctrine:schema:update --force
% pousuwać
#console php app/console doctrine:generate:form PAIBlogBundle:Comment
php app/console doctrine:generate:form PAIBlogBundle:Post
#app % dodać post % dodać komentarz || error _toString()
public function __toString() { return $this->getTitle(); }