[{"data":1,"prerenderedAt":1363},["ShallowReactive",2],{"navigation":3,"\u002Fdigging-deeper\u002Frow-context":173,"\u002Fdigging-deeper\u002Frow-context-surround":1358},[4,27,69,103,113,135],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":26},"Getting Started","i-heroicons-star","\u002Fgetting-started","1.getting-started",[10,14,18,22],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":23,"path":24,"stem":25},"Upgrade guide","\u002Fgetting-started\u002Fupgrade-guide","1.getting-started\u002F5.upgrade-guide",false,{"title":28,"icon":29,"path":30,"stem":31,"children":32,"page":26},"Essentials","i-heroicons-shield-check","\u002Fessentials","2.essentials",[33,37,41,45,49,53,57,61,65],{"title":34,"path":35,"stem":36},"Controls","\u002Fessentials\u002Fcontrols","2.essentials\u002F1.controls",{"title":38,"path":39,"stem":40},"Perimeters","\u002Fessentials\u002Fperimeters","2.essentials\u002F2.perimeters",{"title":42,"path":43,"stem":44},"Perimeter classes","\u002Fessentials\u002Fperimeter-classes","2.essentials\u002F3.perimeter-classes",{"title":46,"path":47,"stem":48},"Levels","\u002Fessentials\u002Flevels","2.essentials\u002F4.levels",{"title":50,"path":51,"stem":52},"Boundaries","\u002Fessentials\u002Fboundaries","2.essentials\u002F5.boundaries",{"title":54,"path":55,"stem":56},"Parents","\u002Fessentials\u002Fparents","2.essentials\u002F6.parents",{"title":58,"path":59,"stem":60},"Policies","\u002Fessentials\u002Fpolicies","2.essentials\u002F7.policies",{"title":62,"path":63,"stem":64},"Queries","\u002Fessentials\u002Fqueries","2.essentials\u002F8.queries",{"title":66,"path":67,"stem":68},"Readers","\u002Fessentials\u002Freaders","2.essentials\u002F9.readers",{"title":70,"icon":71,"path":72,"stem":73,"children":74,"page":26},"Search","i-heroicons-magnifying-glass","\u002Fsearch","3.search",[75,79,83,87,91,95,99],{"title":76,"path":77,"stem":78},"Search overview","\u002Fsearch\u002Foverview","3.search\u002F1.overview",{"title":80,"path":81,"stem":82},"Engines","\u002Fsearch\u002Fengines","3.search\u002F2.engines",{"title":84,"path":85,"stem":86},"Keeping the keys fresh","\u002Fsearch\u002Fkeeping-the-keys-fresh","3.search\u002F3.keeping-the-keys-fresh",{"title":88,"path":89,"stem":90},"Exceptions and dates","\u002Fsearch\u002Fexceptions-and-dates","3.search\u002F4.exceptions-and-dates",{"title":92,"path":93,"stem":94},"Searching through a parent","\u002Fsearch\u002Fthrough-a-parent","3.search\u002F5.through-a-parent",{"title":96,"path":97,"stem":98},"Search from the browser","\u002Fsearch\u002Ffrom-the-browser","3.search\u002F6.from-the-browser",{"title":100,"path":101,"stem":102},"Your own search client","\u002Fsearch\u002Fyour-own-client","3.search\u002F7.your-own-client",{"title":104,"icon":105,"path":106,"stem":107,"children":108,"page":26},"Integrations","i-heroicons-puzzle-piece","\u002Fintegrations","4.integrations",[109],{"title":110,"path":111,"stem":112},"laravel-rest-api","\u002Fintegrations\u002Flaravel-rest-api","4.integrations\u002F1.laravel-rest-api",{"title":114,"icon":115,"path":116,"stem":117,"children":118,"page":26},"Testing and Tooling","i-heroicons-wrench-screwdriver","\u002Ftesting-and-tooling","5.testing-and-tooling",[119,123,127,131],{"title":120,"path":121,"stem":122},"Testing","\u002Ftesting-and-tooling\u002Ftesting","5.testing-and-tooling\u002F1.testing",{"title":124,"path":125,"stem":126},"access:check","\u002Ftesting-and-tooling\u002Faccess-check","5.testing-and-tooling\u002F2.access-check",{"title":128,"path":129,"stem":130},"Cache and about","\u002Ftesting-and-tooling\u002Fcache-and-about","5.testing-and-tooling\u002F3.cache-and-about",{"title":132,"path":133,"stem":134},"Generators","\u002Ftesting-and-tooling\u002Fgenerators","5.testing-and-tooling\u002F4.generators",{"title":136,"icon":137,"path":138,"stem":139,"children":140,"page":26},"Digging Deeper","i-heroicons-list-bullet","\u002Fdigging-deeper","6.digging-deeper",[141,145,149,153,157,161,165,169],{"title":142,"path":143,"stem":144},"Abilities","\u002Fdigging-deeper\u002Fabilities","6.digging-deeper\u002F1.abilities",{"title":146,"path":147,"stem":148},"Kept decisions","\u002Fdigging-deeper\u002Fdecisions","6.digging-deeper\u002F2.decisions",{"title":150,"path":151,"stem":152},"Batched decisions","\u002Fdigging-deeper\u002Fbatched-decisions","6.digging-deeper\u002F3.batched-decisions",{"title":154,"path":155,"stem":156},"Row checks","\u002Fdigging-deeper\u002Frow-checks","6.digging-deeper\u002F4.row-checks",{"title":158,"path":159,"stem":160},"Several brands","\u002Fdigging-deeper\u002Fseveral-brands","6.digging-deeper\u002F5.several-brands",{"title":162,"path":163,"stem":164},"Row context","\u002Fdigging-deeper\u002Frow-context","6.digging-deeper\u002F6.row-context",{"title":166,"path":167,"stem":168},"What is public in 1.x","\u002Fdigging-deeper\u002Fpublic-api","6.digging-deeper\u002F7.public-api",{"title":170,"path":171,"stem":172},"Use with AI","\u002Fdigging-deeper\u002Fuse-with-ai","6.digging-deeper\u002F8.use-with-ai",{"id":174,"title":162,"body":175,"description":1350,"extension":1351,"links":1352,"meta":1353,"navigation":270,"path":163,"seo":1354,"sitemap":1355,"stem":164,"updatedAt":1356,"__hash__":1357},"docs\u002F6.digging-deeper\u002F6.row-context.md",{"type":176,"value":177,"toc":1343},"minimark",[178,198,203,218,500,645,678,684,745,749,756,897,963,969,973,994,998,1102,1106,1119,1292,1339],[179,180,181,182,189,190,193,194,197],"p",{},"A ",[183,184,185],"a",{"href":55},[186,187,188],"code",{},"ThroughParent"," decides its parent under the decision context of the request. When the control of the parent reads several brands from that context, a child row can be opened by a parent readable only in another brand than its own: ",[183,191,158],{"href":192},"\u002Fdigging-deeper\u002Fseveral-brands#a-child-read-through-its-parent"," shows the case. ",[186,195,196],{},"decidedInRowContext()"," decides the parent, for each child row, within the value that the row holds. Replace \"brand\" with the dimension of your application.",[199,200,202],"h2",{"id":201},"declaring-the-switch","Declaring the switch",[179,204,205,206,209,210,213,214,217],{},"Declare once, in the ",[186,207,208],{},"boot()"," method of a service provider and next to ",[186,211,212],{},"Access::decisionContextUsing()",", the values that the request covers and how the application acts in one of them. ",[186,215,216],{},"Brands"," stands for the state of your application:",[219,220,226],"pre",{"className":221,"code":222,"filename":223,"language":224,"meta":225,"style":225},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use Closure;\nuse Lomkit\\Access\\Access;\n\npublic function boot(): void\n{\n    Access::decisionContextUsing(fn (): array => ['brands' => Brands::requested()->sort()->implode(',')]);\n\n    Access::rowContextUsing(\n        values: fn (): array => Brands::requested()->all(),\n        within: fn (int|string $brand, Closure $decide): mixed => Brands::actingIn([$brand], $decide),\n    );\n}\n","app\u002FProviders\u002FAppServiceProvider.php","php","",[186,227,228,245,265,272,292,298,371,376,389,421,488,494],{"__ignoreMap":225},[229,230,233,237,241],"span",{"class":231,"line":232},"line",1,[229,234,236],{"class":235},"sbssI","use",[229,238,240],{"class":239},"sTEyZ"," Closure",[229,242,244],{"class":243},"sMK4o",";\n",[229,246,248,250,253,256,259,261,263],{"class":231,"line":247},2,[229,249,236],{"class":235},[229,251,252],{"class":239}," Lomkit",[229,254,255],{"class":243},"\\",[229,257,258],{"class":239},"Access",[229,260,255],{"class":243},[229,262,258],{"class":239},[229,264,244],{"class":243},[229,266,268],{"class":231,"line":267},3,[229,269,271],{"emptyLinePlaceholder":270},true,"\n",[229,273,275,279,282,286,289],{"class":231,"line":274},4,[229,276,278],{"class":277},"spNyl","public",[229,280,281],{"class":277}," function",[229,283,285],{"class":284},"s2Zo4"," boot",[229,287,288],{"class":243},"():",[229,290,291],{"class":235}," void\n",[229,293,295],{"class":231,"line":294},5,[229,296,297],{"class":243},"{\n",[229,299,301,305,308,311,314,317,320,323,326,329,332,336,338,340,343,345,348,351,354,356,359,361,363,366,368],{"class":231,"line":300},6,[229,302,304],{"class":303},"sBMFI","    Access",[229,306,307],{"class":243},"::",[229,309,310],{"class":284},"decisionContextUsing",[229,312,313],{"class":243},"(",[229,315,316],{"class":277},"fn",[229,318,319],{"class":243}," ():",[229,321,322],{"class":235}," array",[229,324,325],{"class":243}," =>",[229,327,328],{"class":243}," [",[229,330,331],{"class":243},"'",[229,333,335],{"class":334},"sfazB","brands",[229,337,331],{"class":243},[229,339,325],{"class":243},[229,341,342],{"class":303}," Brands",[229,344,307],{"class":243},[229,346,347],{"class":284},"requested",[229,349,350],{"class":243},"()->",[229,352,353],{"class":284},"sort",[229,355,350],{"class":243},[229,357,358],{"class":284},"implode",[229,360,313],{"class":243},[229,362,331],{"class":243},[229,364,365],{"class":334},",",[229,367,331],{"class":243},[229,369,370],{"class":243},")]);\n",[229,372,374],{"class":231,"line":373},7,[229,375,271],{"emptyLinePlaceholder":270},[229,377,379,381,383,386],{"class":231,"line":378},8,[229,380,304],{"class":303},[229,382,307],{"class":243},[229,384,385],{"class":284},"rowContextUsing",[229,387,388],{"class":243},"(\n",[229,390,392,395,398,401,403,405,407,409,411,413,415,418],{"class":231,"line":391},9,[229,393,394],{"class":303},"        values",[229,396,397],{"class":243},":",[229,399,400],{"class":277}," fn",[229,402,319],{"class":243},[229,404,322],{"class":235},[229,406,325],{"class":243},[229,408,342],{"class":303},[229,410,307],{"class":243},[229,412,347],{"class":284},[229,414,350],{"class":243},[229,416,417],{"class":284},"all",[229,419,420],{"class":243},"(),\n",[229,422,424,427,429,431,434,437,440,443,446,449,451,453,455,458,461,464,466,468,470,473,476,478,481,483,485],{"class":231,"line":423},10,[229,425,426],{"class":303},"        within",[229,428,397],{"class":243},[229,430,400],{"class":277},[229,432,433],{"class":243}," (",[229,435,436],{"class":235},"int",[229,438,439],{"class":243},"|",[229,441,442],{"class":235},"string",[229,444,445],{"class":243}," $",[229,447,448],{"class":239},"brand",[229,450,365],{"class":243},[229,452,240],{"class":303},[229,454,445],{"class":243},[229,456,457],{"class":239},"decide",[229,459,460],{"class":243},"):",[229,462,463],{"class":235}," mixed",[229,465,325],{"class":243},[229,467,342],{"class":303},[229,469,307],{"class":243},[229,471,472],{"class":284},"actingIn",[229,474,475],{"class":243},"([$",[229,477,448],{"class":239},[229,479,480],{"class":243},"],",[229,482,445],{"class":243},[229,484,457],{"class":239},[229,486,487],{"class":243},"),\n",[229,489,491],{"class":231,"line":490},11,[229,492,493],{"class":243},"    );\n",[229,495,497],{"class":231,"line":496},12,[229,498,499],{"class":243},"}\n",[219,501,503],{"className":221,"code":502,"language":224,"meta":225,"style":225},"public static function actingIn(array $brands, Closure $callback): mixed\n{\n    $previous = self::$requested;\n    self::$requested = $brands;\n\n    try {\n        return $callback();\n    } finally {\n        self::$requested = $previous;\n    }\n}\n",[186,504,505,540,544,565,583,587,596,608,618,636,641],{"__ignoreMap":225},[229,506,507,509,512,514,517,519,522,524,526,528,530,532,535,537],{"class":231,"line":232},[229,508,278],{"class":277},[229,510,511],{"class":277}," static",[229,513,281],{"class":277},[229,515,516],{"class":284}," actingIn",[229,518,313],{"class":243},[229,520,521],{"class":235},"array",[229,523,445],{"class":243},[229,525,335],{"class":239},[229,527,365],{"class":243},[229,529,240],{"class":303},[229,531,445],{"class":243},[229,533,534],{"class":239},"callback",[229,536,460],{"class":243},[229,538,539],{"class":235}," mixed\n",[229,541,542],{"class":231,"line":247},[229,543,297],{"class":243},[229,545,546,549,552,555,558,561,563],{"class":231,"line":267},[229,547,548],{"class":243},"    $",[229,550,551],{"class":239},"previous ",[229,553,554],{"class":243},"=",[229,556,557],{"class":277}," self",[229,559,560],{"class":243},"::$",[229,562,347],{"class":239},[229,564,244],{"class":243},[229,566,567,570,572,575,577,579,581],{"class":231,"line":274},[229,568,569],{"class":277},"    self",[229,571,560],{"class":243},[229,573,574],{"class":239},"requested ",[229,576,554],{"class":243},[229,578,445],{"class":243},[229,580,335],{"class":239},[229,582,244],{"class":243},[229,584,585],{"class":231,"line":294},[229,586,271],{"emptyLinePlaceholder":270},[229,588,589,593],{"class":231,"line":300},[229,590,592],{"class":591},"s7zQu","    try",[229,594,595],{"class":243}," {\n",[229,597,598,601,603,605],{"class":231,"line":373},[229,599,600],{"class":591},"        return",[229,602,445],{"class":243},[229,604,534],{"class":239},[229,606,607],{"class":243},"();\n",[229,609,610,613,616],{"class":231,"line":378},[229,611,612],{"class":243},"    }",[229,614,615],{"class":591}," finally",[229,617,595],{"class":243},[229,619,620,623,625,627,629,631,634],{"class":231,"line":391},[229,621,622],{"class":277},"        self",[229,624,560],{"class":243},[229,626,574],{"class":239},[229,628,554],{"class":243},[229,630,445],{"class":243},[229,632,633],{"class":239},"previous",[229,635,244],{"class":243},[229,637,638],{"class":231,"line":423},[229,639,640],{"class":243},"    }\n",[229,642,643],{"class":231,"line":490},[229,644,499],{"class":243},[646,647,648,655,669,672],"ul",{},[649,650,651,654],"li",{},[186,652,653],{},"values"," returns the values that the request covers, ints or non-empty strings, exactly as stored in the column of the child rows; an empty list reaches nothing. It must read the same state as the decision context.",[649,656,657,660,661,664,665,668],{},[186,658,659],{},"within"," switches the application to the single value it receives, every state that the parent reads included (the brands, the team of a permission package, a tenant), calls ",[186,662,663],{},"$decide"," exactly once, and restores the previous state in a ",[186,666,667],{},"finally"," block.",[649,670,671],{},"Keep both cheap: they run once per value for each list, and for the first row check of a reader, ability and context in a request.",[649,673,674,675,677],{},"Only the PHP state is switched: ",[186,676,659],{}," runs while the package builds the SQL, and the query runs after it returns. Keep out of the rules of the parent a state that the database reads, such as a session variable or a row-level security policy.",[179,679,680,681,683],{},"Then name, on the ",[186,682,188],{},", the column of the child row that holds the value:",[219,685,688],{"className":221,"code":686,"filename":687,"language":224,"meta":225,"style":225},"ThroughParent::belongsTo('post', inverse: 'comments')\n    ->decidedInRowContext('brand_id'),\n","app\u002FAccess\u002FControls\u002FCommentControl.php",[186,689,690,726],{"__ignoreMap":225},[229,691,692,694,696,699,701,703,706,708,710,713,715,718,721,723],{"class":231,"line":232},[229,693,188],{"class":303},[229,695,307],{"class":243},[229,697,698],{"class":284},"belongsTo",[229,700,313],{"class":243},[229,702,331],{"class":243},[229,704,705],{"class":334},"post",[229,707,331],{"class":243},[229,709,365],{"class":243},[229,711,712],{"class":303}," inverse",[229,714,397],{"class":243},[229,716,717],{"class":243}," '",[229,719,720],{"class":334},"comments",[229,722,331],{"class":243},[229,724,725],{"class":243},")\n",[229,727,728,731,734,736,738,741,743],{"class":231,"line":247},[229,729,730],{"class":243},"    ->",[229,732,733],{"class":284},"decidedInRowContext",[229,735,313],{"class":243},[229,737,331],{"class":243},[229,739,740],{"class":334},"brand_id",[229,742,331],{"class":243},[229,744,487],{"class":243},[199,746,748],{"id":747},"what-it-changes","What it changes",[179,750,751,752,755],{},"The SQL gets one branch per value of the request, each built while ",[186,753,754],{},"within()"," runs for its value:",[219,757,761],{"className":758,"code":759,"language":760,"meta":225,"style":225},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","where (\n     (comments.brand_id = 'A' and exists (select * from posts where posts.id = comments.post_id and (\u003CPostControl within A>)))\n  or (comments.brand_id = 'B' and exists (select * from posts where posts.id = comments.post_id and (\u003CPostControl within B>)))\n)\n","sql",[186,762,763,771,837,893],{"__ignoreMap":225},[229,764,765,768],{"class":231,"line":232},[229,766,767],{"class":235},"where",[229,769,770],{"class":239}," (\n",[229,772,773,776,778,780,783,785,788,791,793,796,799,802,805,807,810,812,815,818,820,823,826,828,831,834],{"class":231,"line":247},[229,774,775],{"class":239},"     (comments.brand_id ",[229,777,554],{"class":243},[229,779,717],{"class":243},[229,781,782],{"class":334},"A",[229,784,331],{"class":243},[229,786,787],{"class":235}," and",[229,789,790],{"class":235}," exists",[229,792,433],{"class":239},[229,794,795],{"class":235},"select",[229,797,798],{"class":243}," *",[229,800,801],{"class":235}," from",[229,803,804],{"class":239}," posts ",[229,806,767],{"class":235},[229,808,809],{"class":239}," posts.id ",[229,811,554],{"class":243},[229,813,814],{"class":239}," comments.post_id ",[229,816,817],{"class":235},"and",[229,819,433],{"class":239},[229,821,822],{"class":243},"\u003C",[229,824,825],{"class":239},"PostControl ",[229,827,659],{"class":235},[229,829,830],{"class":239}," A",[229,832,833],{"class":243},">",[229,835,836],{"class":239},")))\n",[229,838,839,842,845,847,849,852,854,856,858,860,862,864,866,868,870,872,874,876,878,880,882,884,886,889,891],{"class":231,"line":267},[229,840,841],{"class":235},"  or",[229,843,844],{"class":239}," (comments.brand_id ",[229,846,554],{"class":243},[229,848,717],{"class":243},[229,850,851],{"class":334},"B",[229,853,331],{"class":243},[229,855,787],{"class":235},[229,857,790],{"class":235},[229,859,433],{"class":239},[229,861,795],{"class":235},[229,863,798],{"class":243},[229,865,801],{"class":235},[229,867,804],{"class":239},[229,869,767],{"class":235},[229,871,809],{"class":239},[229,873,554],{"class":243},[229,875,814],{"class":239},[229,877,817],{"class":235},[229,879,433],{"class":239},[229,881,822],{"class":243},[229,883,825],{"class":239},[229,885,659],{"class":235},[229,887,888],{"class":239}," B",[229,890,833],{"class":243},[229,892,836],{"class":239},[229,894,895],{"class":231,"line":274},[229,896,725],{"class":239},[646,898,899,912,927,937,940,943],{},[649,900,901,902,905,906,908,909,911],{},"A child row whose value is ",[186,903,904],{},"null",", or not one of ",[186,907,653],{},", has no branch: the ",[186,910,188],{}," refuses it. Reach such rows through another perimeter.",[649,913,914,915,918,919,922,923,926],{},"The policy, the row checks, ",[186,916,917],{},"withAbilities()",", ",[186,920,921],{},"Access::preload()"," and ",[186,924,925],{},"reachableKeys()"," use the same branches.",[649,928,929,930,933,934,936],{},"A decision without a row is granted when there is a value of the request in which the ",[186,931,932],{},"allowed()"," of the ",[186,935,188],{}," accepts and the parent reaches a perimeter.",[649,938,939],{},"A draft reads the column from its attributes, like the foreign key.",[649,941,942],{},"The decisions on the parent are kept under the context of each value, the same key as a request of that value alone.",[649,944,945,947,948,951,952,954,955,958,959,962],{},[186,946,124],{}," prints ",[186,949,950],{},"row context brand_id"," on the line of the ",[186,953,188],{},", and ",[186,956,957],{},"--json"," gives ",[186,960,961],{},"parent.row_context",".",[179,964,965,966,968],{},"Each row gets the answer of its own value alone. That narrows the wide answer only when the rules of the parent grow with the brands: each rule that reads the brands filters the rows by them, and each ",[186,967,932],{}," that reads them accepts as soon as the reader holds the right in one of them. A rule that grants more for fewer brands would open, within one value, a parent that the whole request does not open. No assertion checks it.",[199,970,972],{"id":971},"searching-through-the-parent","Searching through the parent",[179,974,975,976,978,979,982,983,986,987,933,989,991,992,962],{},"A searchable child whose ",[186,977,188],{}," is ",[186,980,981],{},"decidedInRowContext('brand_id')"," writes the value of the child row after the relation: ",[186,984,985],{},"through.post.in.1.2.workspace_id.1.author.7"," for a comment of brand 1. A child without a value carries no key through that parent. The reader gets, for each value of the request where the ",[186,988,932],{},[186,990,188],{}," accepts, the keys of the parent computed within that value. See ",[183,993,92],{"href":93},[199,995,997],{"id":996},"errors","Errors",[999,1000,1001,1014],"table",{},[1002,1003,1004],"thead",{},[1005,1006,1007,1011],"tr",{},[1008,1009,1010],"th",{},"Mistake",[1008,1012,1013],{},"Exception",[1015,1016,1017,1034,1046,1061,1071,1085],"tbody",{},[1005,1018,1019,1028],{},[1020,1021,1022,1024,1025],"td",{},[186,1023,196],{}," without ",[186,1026,1027],{},"Access::rowContextUsing()",[1020,1029,1030,1033],{},[186,1031,1032],{},"MissingRowContextException",", when the control is built",[1005,1035,1036,1041],{},[1020,1037,1038,1040],{},[186,1039,653],{}," returns something else than a list of ints and non-empty strings",[1020,1042,1043],{},[186,1044,1045],{},"InvalidRowContextValuesException",[1005,1047,1048,1056],{},[1020,1049,1050,1052,1053,1055],{},[186,1051,659],{}," does not call ",[186,1054,663],{}," exactly once, leaves the decision context changed, decides under the context of the whole request or of another value, or switches two values to the same context",[1020,1057,1058],{},[186,1059,1060],{},"RowContextSwitchException",[1005,1062,1063,1066],{},[1020,1064,1065],{},"The column is not a plain column name",[1020,1067,1068],{},[186,1069,1070],{},"InvalidRowContextColumnException",[1005,1072,1073,1080],{},[1020,1074,1075,1077,1078],{},[186,1076,196],{}," twice on one ",[186,1079,188],{},[1020,1081,1082],{},[186,1083,1084],{},"DuplicatePerimeterCallbackException",[1005,1086,1087,1096],{},[1020,1088,1089,1090,1092,1093],{},"The ",[186,1091,188],{}," is a level of ",[186,1094,1095],{},"Levels::of()",[1020,1097,1098,1101],{},[186,1099,1100],{},"RowContextInLevelsException",": declare it next to the group",[199,1103,1105],{"id":1104},"testing-the-switch","Testing the switch",[179,1107,1108,1111,1112,1115,1116,1118],{},[186,1109,1110],{},"assertRowContextAgrees()"," compares each row with a request of its value alone, which the test sets up itself through ",[186,1113,1114],{},"alone",", without the ",[186,1117,659],{}," closure under test:",[219,1120,1122],{"className":221,"code":1121,"language":224,"meta":225,"style":225},"public function test_the_brand_switch_is_complete(): void\n{\n    foreach ([$this->headquarters, $this->brandManager] as $reader) {\n        $this->assertRowContextAgrees(\n            CommentControl::class,\n            $reader,\n            Comment::uncontrolled()->get(),\n            alone: fn (int|string $brand, Closure $check): mixed => $this->asBrandRequest($brand, $check),\n        );\n    }\n}\n",[186,1123,1124,1137,1141,1176,1186,1199,1208,1225,1279,1284,1288],{"__ignoreMap":225},[229,1125,1126,1128,1130,1133,1135],{"class":231,"line":232},[229,1127,278],{"class":277},[229,1129,281],{"class":277},[229,1131,1132],{"class":284}," test_the_brand_switch_is_complete",[229,1134,288],{"class":243},[229,1136,291],{"class":235},[229,1138,1139],{"class":231,"line":247},[229,1140,297],{"class":243},[229,1142,1143,1146,1149,1152,1154,1157,1160,1163,1166,1168,1171,1174],{"class":231,"line":267},[229,1144,1145],{"class":591},"    foreach",[229,1147,1148],{"class":243}," ([$this->",[229,1150,1151],{"class":239},"headquarters",[229,1153,365],{"class":243},[229,1155,1156],{"class":243}," $this->",[229,1158,1159],{"class":239},"brandManager",[229,1161,1162],{"class":243},"]",[229,1164,1165],{"class":243}," as",[229,1167,445],{"class":243},[229,1169,1170],{"class":239},"reader",[229,1172,1173],{"class":243},")",[229,1175,595],{"class":243},[229,1177,1178,1181,1184],{"class":231,"line":274},[229,1179,1180],{"class":243},"        $this->",[229,1182,1183],{"class":284},"assertRowContextAgrees",[229,1185,388],{"class":243},[229,1187,1188,1191,1193,1196],{"class":231,"line":294},[229,1189,1190],{"class":303},"            CommentControl",[229,1192,307],{"class":243},[229,1194,1195],{"class":235},"class",[229,1197,1198],{"class":243},",\n",[229,1200,1201,1204,1206],{"class":231,"line":300},[229,1202,1203],{"class":243},"            $",[229,1205,1170],{"class":239},[229,1207,1198],{"class":243},[229,1209,1210,1213,1215,1218,1220,1223],{"class":231,"line":373},[229,1211,1212],{"class":303},"            Comment",[229,1214,307],{"class":243},[229,1216,1217],{"class":284},"uncontrolled",[229,1219,350],{"class":243},[229,1221,1222],{"class":284},"get",[229,1224,420],{"class":243},[229,1226,1227,1230,1232,1234,1236,1238,1240,1242,1244,1246,1248,1250,1252,1255,1257,1259,1261,1263,1266,1269,1271,1273,1275,1277],{"class":231,"line":378},[229,1228,1229],{"class":303},"            alone",[229,1231,397],{"class":243},[229,1233,400],{"class":277},[229,1235,433],{"class":243},[229,1237,436],{"class":235},[229,1239,439],{"class":243},[229,1241,442],{"class":235},[229,1243,445],{"class":243},[229,1245,448],{"class":239},[229,1247,365],{"class":243},[229,1249,240],{"class":303},[229,1251,445],{"class":243},[229,1253,1254],{"class":239},"check",[229,1256,460],{"class":243},[229,1258,463],{"class":235},[229,1260,325],{"class":243},[229,1262,1156],{"class":243},[229,1264,1265],{"class":284},"asBrandRequest",[229,1267,1268],{"class":243},"($",[229,1270,448],{"class":239},[229,1272,365],{"class":243},[229,1274,445],{"class":243},[229,1276,1254],{"class":239},[229,1278,487],{"class":243},[229,1280,1281],{"class":231,"line":391},[229,1282,1283],{"class":243},"        );\n",[229,1285,1286],{"class":231,"line":423},[229,1287,640],{"class":243},[229,1289,1290],{"class":231,"line":490},[229,1291,499],{"class":243},[646,1293,1294,1303,1327,1333],{},[649,1295,1296,1298,1299,1302],{},[186,1297,1114],{}," receives a value and a callback, sets up every state of a real request of that value alone, calls the callback and restores the state. ",[186,1300,1301],{},"asBrandRequest()"," stands for that helper of your tests.",[649,1304,1305,1306,1308,1309,1312,1313,918,1316,922,1319,1322,1323,1326],{},"For each row whose value is one of the request, the assertion compares the answer under the request with the answer inside ",[186,1307,1114],{},", through the Gate and through ",[186,1310,1311],{},"controlledFor()",", for ",[186,1314,1315],{},"view",[186,1317,1318],{},"update",[186,1320,1321],{},"delete"," by default (pass others as ",[186,1324,1325],{},"abilities",").",[649,1328,1329,1330,1332],{},"It catches a ",[186,1331,659],{}," that forgets a state the parent reads, and a perimeter or boundary of the child that reads the brands of the request instead of the brand of the row. It does not check that the rules of the parent grow with the brands.",[649,1334,1335,1336,1338],{},"The control declares exactly one column with ",[186,1337,196],{},", and at least one row holds a value of the request.",[1340,1341,1342],"style",{},"html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}",{"title":225,"searchDepth":232,"depth":247,"links":1344},[1345,1346,1347,1348,1349],{"id":201,"depth":247,"text":202},{"id":747,"depth":247,"text":748},{"id":971,"depth":247,"text":972},{"id":996,"depth":247,"text":997},{"id":1104,"depth":247,"text":1105},"Decide the parent of a ThroughParent in the brand or tenant of each child row with decidedInRowContext() and Access::rowContextUsing(), and test the switch.","md",null,{},{"title":162,"description":1350},{"loc":163,"lastmod":1356},"2026-11-21T16:10:34+01:00","XD5ejEO_1dnfYUJN-6S0w226PwCaFH0ojZhIDwUK1Co",[1359,1361],{"title":158,"path":159,"stem":160,"description":1360,"children":-1},"List the rows of several brands, tenants or companies in one query with perimeters that read the brand of the row, and know when a parent needs the row's brand.",{"title":166,"path":167,"stem":168,"description":1362,"children":-1},"The releases of 1.x follow semantic versioning for what this documentation describes. Learn what that covers, and what may change in any release.",1795277182327]