* @ORM\ManyToOne(targetEntity=News::class)
*/
private ?self $relatedNews;
/**
* @ORM\OneToMany(targetEntity=News::class, mappedBy="relatedNews")
*/
private ?Collection $related;
Видел, пробовал? https://stackoverflow.com/questions/45563694/doctrine-one-to-many-self-referencing-dont-work
Не видел, пробую
/** * @ORM\OneToMany(targetEntity=News::class, mappedBy="relatedNews") */ private $related; /** * @ORM\ManyToOne(targetEntity=News::class, inversedBy="related") * @ORM\JoinColumn(name="related_news_id", referencedColumnName="id", nullable=true) */ private $relatedNews;
[2021-04-27T15:20:55.951825+03:00] request.INFO: Matched route "adminDashboard". {"route":"adminDashboard","route_parameters":{"_route":"adminDashboard","_controller":"App\\Controller\\Admin\\DashboardController::index"},"request_uri":"http://pershij.loc/admin?crudAction=new&crudControllerFqcn=App%5CController%5CAdmin%5CNewsCrudController&menuIndex=6&referrer=http%3A%2F%2Fpershij.loc%2Fadmin%3FcrudAction%3Dindex%26crudControllerFqcn%3DApp%255CController%255CAdmin%255CNewsCrudController%26menuIndex%3D6%26signature%3DchRdeumkTTzx5_H1V5T7-6upv3qhsV88N0ZQfZGMcMI%26submenuIndex%3D-1&signature=gA1ckw3OAaeRanPrDGfRg_NYBYhKlDET9lfqTlv8hPw&submenuIndex=-1","method":"GET"} [] [2021-04-27T15:20:55.954613+03:00] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"main","authenticators":1} [] [2021-04-27T15:20:55.954839+03:00] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"main","authenticator":"App\\Security\\LoginFormAuthenticator"} [] [2021-04-27T15:20:55.954999+03:00] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"main","authenticator":"App\\Security\\LoginFormAuthenticator"} [] [2021-04-27T15:20:55.956164+03:00] security.DEBUG: Read existing security token from the session. {"key":"_security_main","token_class":"Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken"} [] [2021-04-27T15:20:55.967087+03:00] doctrine.DEBUG: SELECT t0.id AS id_1, t0.username AS username_2, t0.roles AS roles_3, t0.password AS password_4, t0.nice_name AS nice_name_5, t0.avatar AS avatar_6 FROM user t0 WHERE t0.id = ? [1] [] [2021-04-27T15:20:55.988508+03:00] security.DEBUG: User was reloaded from a user provider. {"provider":"Symfony\\Bridge\\Doctrine\\Security\\User\\EntityUserProvider","username":"yonchi"} [] [2021-04-27T15:20:56.062544+03:00] doctrine.DEBUG: SELECT c0_.id AS id_0, c0_.name AS name_1, c0_.description AS description_2, c0_.keywords AS keywords_3, c0_.is_active AS is_active_4, c0_.slug AS slug_5 FROM categories c0_ [] [] [2021-04-27T15:20:56.068065+03:00] doctrine.DEBUG: SELECT t0_.id AS id_0, t0_.name AS name_1, t0_.slug AS slug_2 FROM tags t0_ [] [] [2021-04-27T15:20:56.069254+03:00] doctrine.DEBUG: SELECT n0_.id AS id_0, n0_.title AS title_1, n0_.content AS content_2, n0_.keywords AS keywords_3, n0_.image AS image_4, n0_.created_at AS created_at_5, n0_.updated_at AS updated_at_6, n0_.is_active AS is_active_7, n0_.slug AS slug_8, n0_.views AS views_9, n0_.comments AS comments_10, n0_.status AS status_11, n0_.type AS type_12, n0_.author_id AS author_id_13, n0_.related_news_id AS related_news_id_14 FROM news n0_ [] [] [2021-04-27T15:20:57.055955+03:00] php.CRITICAL: Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 241664 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\OutOfMemoryError(code: 0): Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 241664 bytes) at /home/dev/symfony/pershij_com_ua/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:132)"} [] [2021-04-27T15:20:57.061289+03:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\OutOfMemoryError: "Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 241664 bytes)" at /home/dev/symfony/pershij_com_ua/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php line 132 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\OutOfMemoryError(code: 0): Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 241664 bytes) at /home/dev/symfony/pershij_com_ua/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:132)"} []
бахни лимит на количество записей
Можна как то в аннотации?
Это работает при 100-200 новостей
Мне кажеться - все из-за запроса на все новости. Как мне ограничить их например к 10?
Обсуждают сегодня