Friday, 15 August 2014

redbean - Can I do multi mapping with redbeanphp? -


Can I load an object and it's only related to a question?

Therefore, if I join my parents' parents, then parent.id = child.parent_id

   

Choose and arrange your parents with the array of bean that is informed by that question?

Yes, you can do this in "RedBean" manual. Is documented in the form.

With the query you can query:

  & lt ;? Php is required 'rb.php'; // 4.2.4, for record R: setup (); // --- fixtures --- $ parent = R: disorder ('guardian'); $ Parent- & gt; Name = "foo"; $ Child = r :: sales ('child'); $ Child-> Name = "bar"; $ ChildId = R: Store ($ child); $ Parent- & gt; Self-styled [] = $ child; $ ParentId = R: Store ($ original); // --- Multi Mapping --- $ Beans = R :: Find Multi ('Parents, Children', 'Select Parents. *, Child. * Parents Join Inner Child Parents Id = child.parent_id WHERE parent.id ($ parent, $ c) {$ parent $], $ [$ parent], [$ parentId], [['a' = & gt; 'parent', ' B '= & gt;' child ',' maitier '=> gt; gt == $ c-> parent_id;},' do '=> function ($ p, $ c) {$ P-> Nolode () -> Autocomplete List [$ c-> ID] = $ C;}]]]); // Make sure we do not get free loaded results ... R :: Enqueque (); Echo $ Beans ['Parent'] [$ parent ID] - & gt; Selflisted booklist [$ childId] - & gt; Name, "\ n";  

Output:

  bar  

We win.


No comments:

Post a Comment