я понимаю когда важно сохранять целостность важных данных и т.д
допустим у меня почти все модели которые хранят id-пользователей которые создали, меняли и т.д. насколько это важно
You should not assume that equal hash codes imply object equality.
You should never persist or use a hash code outside the application domain in which it was created, because the same object may hash across application domains, processes, and platforms.
CREATE TABLE `Books` (
`id` INT NOT NULL,
`name` CHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
INSERT INTO Books (`id`, `name`) VALUES
(1, 'one'),
(2, 'one'),
(2, 'two'),
(3, 'one'),
(3, 'two')
(3, 'three')
;
SELECT * FROM Books WHERE id = 3;
SELECT * FROM Books WHERE id = 2;
SELECT * FROM Books WHERE id = 1;
routing.yml
app:
resource: "@AppBundle/Controller/DefaultController.php"
type: annotation
demo:
resource: "@AppBundle/Controller/DemoController.php"
prefix: "/demo"
type: annotation
other:
resource: "@AppBundle/Controller/OtherController.php"
prefix: "/other"
type: annotation
AbstractController.php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
abstract class AbstractController extends Controller
{
/**
* @param Request $request
* @return Response
* @Route("/")
*/
public function indexAction(Request $request)
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
]);
}
/**
* @param Request $request
* @Route("/demo/")
* @return Response
*/
public function demoAction(Request $request)
{
return new Response(sprintf("I'm %s controller", static::class));
}
}
DefaultController.php
namespace AppBundle\Controller;
class DefaultController extends AbstractController {}
OtherController.php
namespace AppBundle\Controller;
class OtherController extends AbstractController {}
DemoController.php
namespace AppBundle\Controller;
class DemoController extends AbstractController {}