public function testMatchesRemoteValue() { $parent = new DefaultModel(); $parent->setId(1); $child = new DefaultModel(); $child->setPropertyRaw('pid', 1); $child->setId(2); $condition = new ParentChildCondition(); $condition->setFilterArray(array(array('local' => 'id', 'operation' => '=', 'remote_value' => '2'))); $this->assertTrue($condition->matches($parent, $child)); }
/** * Create an entity from a data row. * * @param array $row The data row. * @param string $tableName The table name. * * @return Entity */ public function createFromArray(array $row, $tableName) { $model = new DefaultModel(); $model->setProviderName($tableName); $model->setId($row['id']); foreach ($row as $name => $value) { $model->setPropertyRaw($name, $value); } return $model; }