public function findOne($primary)
    {
        $item = $this->getRegistry()->get($primary);
        if (!$item) {
            $all = $this->getRegistry()->get("all");
            if ($all) {
                $item = $all[$primary];
            }
            if (!$item) {
                $params['where'][] = ["`{$this->getTable()}`.`{$this->getPrimaryKey()}` = ?", $primary];
                $item = $this->findOneByParams($params);
                if ($item) {
                    $this->getRegistry()->set($primary, $item);
                }

                return $item;
            }
        }

        return $item;
    }
public function findOne($primary)
    {
        $item = $this->getRegistry()->get($primary);
        if (!$item) {
            $all = $this->getRegistry()->get("all");
            if ($all) {
                $item = $all[$primary];
            }
            if (!$item) {
                $params['where'][] = ["`{$this->getTable()}`.`{$this->getPrimaryKey()}` = ?", $primary];
                $item = $this->findOneByParams($params);
                if ($item) {
                    $this->getRegistry()->set($primary, $item);
                }

                return $item;
            }
        }

        return $item;
    }
public function findOne ( $ primary ) { $ item = $ this -> getRegistry ( ) -> get ( $ primary ) ; if ( ! $ item ) { $ all = $ this -> getRegistry ( ) -> get ( "all" ) ; if ( $ all ) { $ item = $ all [ $ primary ] ; } if ( ! $ item ) { $ params [ 'where' ] [ ] = [ "`{$this->getTable()}`.`{$this->getPrimaryKey()}` = ?" , $ primary ] ; $ item = $ this -> findOneByParams ( $ params ) ; if ( $ item ) { $ this -> getRegistry ( ) -> set ( $ primary , $ item ) ; } return $ item ; } } return $ item ; }
Checks the registry before fetching from the database
@param mixed $primary
@return Record
Checks the registry before fetching from the database