src/Entity.php
public function load($value, $field = 'id', array $fields = null): self
    {
        $data = $this->medoo->get($this->getTable(), $fields ?? '*', [$field => $value]);
        $this->data = \is_array($data) ? $data : []; //handle empty result gracefuly
        $this->sentry->breadcrumbs->record([
            'message' => 'Entity '.$this->__getEntityName().'::load('.$value.', '.$field.', ['.\implode(', ', $fields ?? []).')',
            'data' => ['query' => $this->medoo->last()],
            'category' => 'Database',
            'level' => 'info',
        ]);

        return $this;
    }
public function load($value, $field = 'id', array $fields = null): self
    {
        $data = $this->medoo->get($this->getTable(), $fields ?? '*', [$field => $value]);
        $this->data = \is_array($data) ? $data : []; //handle empty result gracefuly
        $this->sentry->breadcrumbs->record([
            'message' => 'Entity '.$this->__getEntityName().'::load('.$value.', '.$field.', ['.\implode(', ', $fields ?? []).')',
            'data' => ['query' => $this->medoo->last()],
            'category' => 'Database',
            'level' => 'info',
        ]);

        return $this;
    }
public function load ( $ value , $ field = 'id' , array $ fields = null ) : self { $ data = $ this -> medoo -> get ( $ this -> getTable ( ) , $ fields ?? '*' , [ $ field => $ value ] ) ; $ this -> data = \ is_array ( $ data ) ? $ data : [ ] ; //handle empty result gracefuly $ this -> sentry -> breadcrumbs -> record ( [ 'message' => 'Entity ' . $ this -> __getEntityName ( ) . '::load(' . $ value . ', ' . $ field . ', [' . \ implode ( ', ' , $ fields ?? [ ] ) . ')' , 'data' => [ 'query' => $ this -> medoo -> last ( ) ] , 'category' => 'Database' , 'level' => 'info' , ] ) ; return $ this ; }
Load entity (data from db).

@param mixed  $value  Field value (eg: id field with value = 10)
@param string $field  Field name, default: id
@param array  $fields Fields (columns) to load, default: all

@return Entity
Load entity ( data from db ) .