find Multiple Column in Model |
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 Sercan YANBULOGLU
SEO links REDACTED, per forum policy
|
Welcome Guest, Not a member yet? Register Sign In |