Welcome Guest, Not a member yet? Register   Sign In
find Multiple Column in Model
#1

I create a category model and ı want to choose three column. but findColumn Method permission this.
it's say $column_name should be a name of single column else you will get the DataException.

Do you suggest try modify this function


public function findColumn(string $columnName)
{
  if (strpos($columnName',') !== false)
  {
      throw DataException::forFindColumnHaveMultipleColumns();
  }

  $resultSet $this->select($columnName)
                ->asArray()
                ->find();

  return (! empty($resultSet)) ? array_column($resultSet$columnName) : null;
}



for example 

public function findColumnAll(array $columnName)
{

$selectString="";
  foreach($columnName as $k=>$v){
  
   $selectString.=$v;
   }

  $resultSet $this->select($selectString)
                ->asArray()
                ->find();

  return (! empty($resultSet)) ? $resultSet : null;
}

What do you think About This ??? Does it cause any problem  Huh Huh
Sercan YANBULOGLU
SEO links REDACTED, per forum policy
Reply




Theme © iAndrew 2016 - Forum software by © MyBB