Daniia/Daniia.php
final public function find($ids=[]) {
      if (func_num_args()>0) {
         if (func_num_args()===1) {
            if (!is_array($ids)) {
               $ids = (array) $ids ;
            }
         }
         else {
            $ids = func_get_args();
         }
      }

      $closure = NULL;
      if ( count(func_get_args())>1 ) {
         if ( $ids[count($ids)-1] instanceof \Closure ) {
            $closure = array_pop($ids);
         }
         if (is_array($ids[0])) {
            $ids = $ids[0];
         }
      }

      $this->find_first_data = $this->find_save_data = $this->find_delete_data = TRUE;

      if ( count($ids) && !(@$ids[0] instanceof \Closure) ) {
         if ( $this->is_assoc( $ids ) ) {
            $this->where( $ids );
         }
         else {
            $this->where( $this->primaryKey, 'in', $ids );
         }
      }

      $this->get();

      if (count($ids)===1 && count($this->data)===1) {
         $this->data = $this->data[0];
      }

      if ($closure instanceof \Closure) {
         $this->data = $closure( $this->data, $this );
      }

      return $this;
   }
final public function find($ids=[]) {
      if (func_num_args()>0) {
         if (func_num_args()===1) {
            if (!is_array($ids)) {
               $ids = (array) $ids ;
            }
         }
         else {
            $ids = func_get_args();
         }
      }

      $closure = NULL;
      if ( count(func_get_args())>1 ) {
         if ( $ids[count($ids)-1] instanceof \Closure ) {
            $closure = array_pop($ids);
         }
         if (is_array($ids[0])) {
            $ids = $ids[0];
         }
      }

      $this->find_first_data = $this->find_save_data = $this->find_delete_data = TRUE;

      if ( count($ids) && !(@$ids[0] instanceof \Closure) ) {
         if ( $this->is_assoc( $ids ) ) {
            $this->where( $ids );
         }
         else {
            $this->where( $this->primaryKey, 'in', $ids );
         }
      }

      $this->get();

      if (count($ids)===1 && count($this->data)===1) {
         $this->data = $this->data[0];
      }

      if ($closure instanceof \Closure) {
         $this->data = $closure( $this->data, $this );
      }

      return $this;
   }
final public function find ( $ ids = [ ] ) { if ( func_num_args ( ) > 0 ) { if ( func_num_args ( ) === 1 ) { if ( ! is_array ( $ ids ) ) { $ ids = ( array ) $ ids ; } } else { $ ids = func_get_args ( ) ; } } $ closure = NULL ; if ( count ( func_get_args ( ) ) > 1 ) { if ( $ ids [ count ( $ ids ) - 1 ] instanceof \ Closure ) { $ closure = array_pop ( $ ids ) ; } if ( is_array ( $ ids [ 0 ] ) ) { $ ids = $ ids [ 0 ] ; } } $ this -> find_first_data = $ this -> find_save_data = $ this -> find_delete_data = TRUE ; if ( count ( $ ids ) && ! ( @ $ ids [ 0 ] instanceof \ Closure ) ) { if ( $ this -> is_assoc ( $ ids ) ) { $ this -> where ( $ ids ) ; } else { $ this -> where ( $ this -> primaryKey , 'in' , $ ids ) ; } } $ this -> get ( ) ; if ( count ( $ ids ) === 1 && count ( $ this -> data ) === 1 ) { $ this -> data = $ this -> data [ 0 ] ; } if ( $ closure instanceof \ Closure ) { $ this -> data = $ closure ( $ this -> data , $ this ) ; } return $ this ; }
Busca uno o varios registros en la Base de Datos
@author Carlos Garcia
@param Array $ids
@return Array|Object
Busca uno o varios registros en la Base de Datos