getReflection() public static method

Gets reflection of current entity
public static getReflection ( leanmapper\IMapper $mapper = null ) : EntityReflection
$mapper leanmapper\IMapper
return LeanMapper\Reflection\EntityReflection
Exemplo n.º 1
0
 /**
  * @param Entity $entity
  * @return \DibiResult|int
  */
 protected function updateInDatabase(Entity $entity)
 {
     $primaryKey = $this->mapper->getPrimaryKey($this->getTable());
     $idField = $this->mapper->getEntityField($this->getTable(), $primaryKey);
     $values = $entity->getModifiedRowData();
     $this->changeEmptyStringsToNull($values, $entity->getReflection()->getEntityProperties());
     return $this->connection->query('UPDATE %n SET %a WHERE %n = ?', $this->getTable(), $values, $primaryKey, $entity->{$idField});
 }