Skip to content

ADP1903 2: containsOne, containsMany

Romans Malinovskis edited this page Mar 21, 2019 · 1 revision

$order->containsMany('labels', [new Labels(), 'serialize'=>'json']);

$order->addField('users', ['serialize'=>'json']);
$order->hasMany('Users', [new User(), 'serialize'=>'json']);


$order->containsOne('label', new Label());
$order->addCondition('label.name', 'red');
$order->ref('label')['name'];

$order->hasOne('owner_id', new User());
$order->addCondition('owner_id.name', 'John');



$order->hasMany('Lines', new Line());
$order->addCondition('Lines.qty', '>', 1);  // will imply Line['deleted'] = false

$order->addCondition($order->dsql->json_contains(''))


$order->ref('label')->loadAny()['name'];



$order->addField('config', ['serialize'=>'json']);
$order->addCondition('config', new XPathCondition('//'));



$order->containsMany('Lines', new Line());
$order->hasOne('current_line', $order->ref('Lines'));


$array_persiscene = [
 'users'=> [
    1=>[],
    2=>['labels'=>['green','blue',3]],

 ],
 'orders'=> [
    1=>[],
    2=>[]
],
  'labels'=>[
    'green'=>['enabled'=>true],
    'blue'=>['enabled'=>false]
 ]

]

$json_persistence = [
 1=>['name'=>'John', 'order'=>[
     1=>['ref'=>123],
     2=>[],
 ]]