L481-493
if ( $this->hasValues($this->keys) ) {
foreach($inserts as $key => $val)
{
if ( ! in_array($key, $inserts) ) {
continue;
}
$entity->{$key} = $val;
}
return $entity;
}
Assume that $this->keys has a value: ['first_name', 'last_name']. The $inserts has this value:
[ 'username' => 'mlester', 'first_name' => 'Moe', 'last_name' => 'Lester' ].
So the in the first iteration shall be like this...
"If username is in ['mlester', 'Moe', 'Lester'] , continue."
What for?
Is this what was meant?
if ( $this->hasValues($this->keys) ) {
foreach($inserts as $key => $val)
{
if ( ! in_array($key, $this->keys) ) {
continue;
}
$entity->{$key} = $val;
}
return $entity;
}
If summarized, the snippet means that any element that has a key not found in $this->keys shall make the loop continue without going assigning a property-value pair ($entity->{$key} = $val;) to the $entity
L481-493
Assume that
$this->keyshas a value:['first_name', 'last_name']. The$insertshas this value:[ 'username' => 'mlester', 'first_name' => 'Moe', 'last_name' => 'Lester' ].So the in the first iteration shall be like this...
"If
usernameis in['mlester', 'Moe', 'Lester'], continue."What for?
Is this what was meant?
If summarized, the snippet means that any element that has a key not found in
$this->keysshall make the loopcontinuewithout going assigning a property-value pair ($entity->{$key} = $val;) to the$entity