This file contains hidden or 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
<?php | |
namespace BlogBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Users | |
* | |
* @ORM\Table(name="users") |
This file contains hidden or 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
# To get started with security, check out the documentation: | |
# http://symfony.com/doc/current/book/security.html | |
security: | |
encoders: | |
Blogbundle\Entity\Users: | |
algorithm: bcrypt | |
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers | |
providers: |
This file contains hidden or 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
/** | |
* Displays a form to edit an existing Users entity. | |
* | |
* @Route("/{id}/edit", name="users_edit") | |
* @Method({"GET", "POST"}) | |
*/ | |
public function editAction(Request $request, Users $user) | |
{ | |
$deleteForm = $this->createDeleteForm($user); | |
$editForm = $this->createForm('BlogBundle\Form\UsersType', $user); |
This file contains hidden or 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
<?php | |
namespace BlogBundle\Form; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
use Symfony\Component\Form\Extension\Core\Type\EmailType; | |
use Symfony\Component\Form\Extension\Core\Type\TextType; | |
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; |
This file contains hidden or 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
ALTER TABLE post | |
ADD FOREIGN KEY (`userid`) | |
REFERENCES user(`id`) | |
ON DELETE CASCADE | |
ON UPDATE CASCADE |
This file contains hidden or 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
ALTER TABLE post | |
ADD FOREIGN KEY (`userid`) | |
REFERENCES user(`id`) | |
ON DELETE CASCADE | |
ON UPDATE CASCADE | |
This file contains hidden or 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
alter table post drop foreign key post_ibfk_1 |
This file contains hidden or 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
CREATE DATABASE `blog` /*!40100 DEFAULT CHARACTER SET utf8 */; | |
CREATE TABLE `post` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, | |
`content` longtext COLLATE utf8_unicode_ci NOT NULL, | |
`userid` int(11) NOT NULL, | |
`created` datetime NOT NULL, | |
`updated` datetime DEFAULT NULL, | |
PRIMARY KEY (`id`), | |
KEY `userid` (`userid`), |
This file contains hidden or 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
<?php | |
namespace Check\BlogBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Post | |
* | |
* @ORM\Table(name="post", indexes={@ORM\Index(name="userid", columns={"userid"})}) |
This file contains hidden or 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
<?php | |
namespace Check\BlogBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* Replies | |
* | |
* @ORM\Table(name="replies", indexes={@ORM\Index(name="userid", columns={"userid"}), @ORM\Index(name="postid", columns={"postid"})}) |