{"action":"created","issue":{"url":"https://api.github.com/repos/nextras/orm/issues/325","repository_url":"https://api.github.com/repos/nextras/orm","labels_url":"https://api.github.com/repos/nextras/orm/issues/325/labels{/name}","comments_url":"https://api.github.com/repos/nextras/orm/issues/325/comments","events_url":"https://api.github.com/repos/nextras/orm/issues/325/events","html_url":"https://github.com/nextras/orm/issues/325","id":391513062,"node_id":"MDU6SXNzdWUzOTE1MTMwNjI=","number":325,"title":"Persist cycle detected use manual two phase persist","user":{"login":"suchoproduction","id":6931349,"node_id":"MDQ6VXNlcjY5MzEzNDk=","avatar_url":"https://avatars3.githubusercontent.com/u/6931349?v=4","gravatar_id":"","url":"https://api.github.com/users/suchoproduction","html_url":"https://github.com/suchoproduction","followers_url":"https://api.github.com/users/suchoproduction/followers","following_url":"https://api.github.com/users/suchoproduction/following{/other_user}","gists_url":"https://api.github.com/users/suchoproduction/gists{/gist_id}","starred_url":"https://api.github.com/users/suchoproduction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suchoproduction/subscriptions","organizations_url":"https://api.github.com/users/suchoproduction/orgs","repos_url":"https://api.github.com/users/suchoproduction/repos","events_url":"https://api.github.com/users/suchoproduction/events{/privacy}","received_events_url":"https://api.github.com/users/suchoproduction/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-16T22:40:37Z","updated_at":"2018-12-17T19:42:20Z","closed_at":null,"author_association":"NONE","body":"Ahoj mám takýto problém po vytvorení entity s dvoma jazykmi mi to vráti takúto hlášku\r\n```\r\nPersist cycle detected in App\\Models\\PageLang\\PageLang::$lang. Use manual two phase persist.\r\n```\r\nMám správne pridané `cascade=[persist, remove]` ?\r\nViete mi skontrolovať aj tie `1:1` či takto môžu byť a celkovo či rozumiem správne tým vzťahom?\r\n\r\n\r\n**`Page`** entity\r\nSú dajme tomu stránky\r\n```php\r\n/**\r\n * @property int                        $id {primary}\r\n * @property \\DateTimeImmutable         $createdAt {default now}\r\n * @property ManyHasOne|User|null       $createdUser {m:1 User, oneSided=true}\r\n * @property OneHasOne|Deleted|null     $deleted {1:1 Deleted, isMain=true, oneSided=true}\r\n *\r\n * Relations\r\n * @property OneHasMany|Content[]       $content {1:m Content::$page, orderBy=[sort=ASC], cascade=[persist, remove]}\r\n * @property OneHasMany|PageLang[]      $langs {1:m PageLang::$page, cascade=[persist, remove]}\r\n */\r\nclass Page extends BaseEntity\r\n{\r\n\r\n{\r\n```\r\n\r\n**`PageLang`** entity\r\nSú jazykové mutácie stránok prepojené s jazykom a stránkou\r\n```php\r\n/**\r\n * @property int                $id {primary}\r\n * @property OneHasOne|Language $lang {1:1 Language, isMain=true, oneSided=true}\r\n * @property ManyHasOne|Page    $page {m:1 Page::$langs}\r\n * @property string             $title\r\n * @property string|null        $description\r\n */\r\nclass PageLang extends BaseEntity\r\n{\r\n\r\n}\r\n```\r\n**`Language`** entity\r\nTabuľka s povolenými jazykmi\r\n```php\r\n/**\r\n * @property int                        $id {primary}\r\n * @property string                     $code\r\n * @property string                     $title\r\n * @property string                     $locale\r\n * @property int                        $active {default 1}\r\n * @property int                        $main {default 0}\r\n * @property OneHasOne|Deleted|null     $deleted {1:1 Deleted, isMain=true, oneSided=true}\r\n */\r\nclass Language extends BaseEntity\r\n{\r\n\r\n}\r\n```\r\n\r\n**`PageFacade`**\r\nObsahuje funkciu na pridanie stránky kde je foreachnutý zoznam jazykov\r\n```php\r\nclass PageFacade extends BaseFacade\r\n{\r\n    /** @var PageRepository */\r\n    private $repository;\r\n\r\n\r\n    public function __construct(\r\n        Container $container,\r\n        PageRepository $repository\r\n    ) {\r\n        parent::__construct($container);\r\n\r\n        $this->repository = $repository;\r\n    }\r\n\r\n\r\n    public function createPage()\r\n    {\r\n        $entity = new Page();\r\n        $entity->createdUser = $this->user->getEntity();\r\n\r\n        foreach ($this->languageList as $lang) {\r\n            $lang = new PageLang();\r\n            $lang->lang = $lang;\r\n            $lang->page = $entity;\r\n\r\n            $entity->langs->add($lang);\r\n        }\r\n\r\n        return $this->repository->create($entity);\r\n    }\r\n\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/nextras/orm/issues/comments/447972858","html_url":"https://github.com/nextras/orm/issues/325#issuecomment-447972858","issue_url":"https://api.github.com/repos/nextras/orm/issues/325","id":447972858,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Nzk3Mjg1OA==","user":{"login":"suchoproduction","id":6931349,"node_id":"MDQ6VXNlcjY5MzEzNDk=","avatar_url":"https://avatars3.githubusercontent.com/u/6931349?v=4","gravatar_id":"","url":"https://api.github.com/users/suchoproduction","html_url":"https://github.com/suchoproduction","followers_url":"https://api.github.com/users/suchoproduction/followers","following_url":"https://api.github.com/users/suchoproduction/following{/other_user}","gists_url":"https://api.github.com/users/suchoproduction/gists{/gist_id}","starred_url":"https://api.github.com/users/suchoproduction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suchoproduction/subscriptions","organizations_url":"https://api.github.com/users/suchoproduction/orgs","repos_url":"https://api.github.com/users/suchoproduction/repos","events_url":"https://api.github.com/users/suchoproduction/events{/privacy}","received_events_url":"https://api.github.com/users/suchoproduction/received_events","type":"User","site_admin":false},"created_at":"2018-12-17T19:42:20Z","updated_at":"2018-12-17T19:42:20Z","author_association":"NONE","body":"Našiel som pár vecí na fóre tak to idem vyskúšať\r\n\r\n- https://forum.nette.org/cs/18050-nextras-orm-orm-nad-nextras-dbal#p139502\r\n- https://forum.nette.org/cs/18050-nextras-orm-orm-nad-nextras-dbal?p=7#p174668\r\n- https://forum.nette.org/cs/18050-nextras-orm-orm-nad-nextras-dbal?p=7#p174889\r\n- https://forum.nette.org/cs/18050-nextras-orm-orm-nad-nextras-dbal?p=7#p174954\r\n"}}
{"actor":{"display_login":"suchoproduction"}}