original_string: public function getVersions(EntityInterface $entity)
      {
          $primaryKey = (array)$this->_table->getPrimaryKey();
  
          $query = $this->_table->find('versions');
          $pkValue = $entity->extract($primaryKey);
          $conditions = [];
          foreach ($pkValue as $key => $value) {
              $field = current($query->aliasField($key));
              $conditions[$field] = $value;
          }
          $entities = $query->where($conditions)->all();
  
          if (empty($entities)) {
              return new Collection([]);
          }
  
          $entity = $entities->first();
  
          return $entity->get('_versions');
      }
code: public function getVersions(EntityInterface $entity)
      {
          $primaryKey = (array)$this->_table->getPrimaryKey();
  
          $query = $this->_table->find('versions');
          $pkValue = $entity->extract($primaryKey);
          $conditions = [];
          foreach ($pkValue as $key => $value) {
              $field = current($query->aliasField($key));
              $conditions[$field] = $value;
          }
          $entities = $query->where($conditions)->all();
  
          if (empty($entities)) {
              return new Collection([]);
          }
  
          $entity = $entities->first();
  
          return $entity->get('_versions');
      }
code_tokens: public function getVersions ( EntityInterface $ entity ) { $ primaryKey = ( array ) $ this -> _table -> getPrimaryKey ( ) ; $ query = $ this -> _table -> find ( 'versions' ) ; $ pkValue = $ entity -> extract ( $ primaryKey ) ; $ conditions = [ ] ; foreach ( $ pkValue as $ key => $ value ) { $ field = current ( $ query -> aliasField ( $ key ) ) ; $ conditions [ $ field ] = $ value ; } $ entities = $ query -> where ( $ conditions ) -> all ( ) ; if ( empty ( $ entities ) ) { return new Collection ( [ ] ) ; } $ entity = $ entities -> first ( ) ; return $ entity -> get ( '_versions' ) ; }
docstring: Returns the versions of a specific entity.
  
  @param \Cake\Datasource\EntityInterface $entity Entity.
  @return \Cake\Collection\CollectionInterface
docstring_tokens: Returns the versions of a specific entity .