BomAle Posted June 29, 2016 Share Posted June 29, 2016 I am finding into a way to access on where property (without extend class) but i have not found any way. $query = \IPS\Content\Search\Query::init()->setOrder( \IPS\Content\Search\Query::ORDER_NEWEST_UPDATED ); foreach ( \IPS\Application::allExtensions( 'core', 'ContentRouter', FALSE ) as $object ) { foreach ( $object->classes as $class ) { if ( in_array('IPS\Content\Polls',class_implements($class)) ) { $filters[] = \IPS\Content\Search\ContentFilter::init( $class, TRUE, FALSE, FALSE ); } } } $results = $query->filterByContent($filters)->search(); var_dump($results);exit; I would: $this->where[] = $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['poll'] . '>=' . intval( 1 ); Link to comment Share on other sites More sharing options...
BomAle Posted June 30, 2016 Author Share Posted June 30, 2016 $select = 'core_polls.*'; $join = array(); foreach ( \IPS\Content::routedClasses( FALSE, FALSE, TRUE ) as $class ) { /*FIX, @TODO when __callStatic on IPS\cms\Records1 call the __construct or fix the hook97 "records.php"*/ if(mb_strpos($class,'IPS\cms\Records') !== FALSE and is_numeric( mb_substr( $class, 15, 1 ) )) { if(!in_array('\\IPS\cms\\Records', get_declared_classes())) { new $class; } } if ( in_array('IPS\Content\Polls',class_implements($class)) AND isset($class::$databaseColumnMap['poll'])) { $join[] = array($class::$databaseTable, $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['poll'] . '=core_polls.pid'); $select .= ', CONCAT("'.\IPS\Db::i()->escape_string($class).'") as item_class, '.$class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnId.' as item_id'; } } $query = \IPS\Db::i()->select( $select, 'core_polls' ); foreach($join as $j) { $query->join($j[0],$j[1]); } $results = array(); foreach ($query as $k => $r) { if($r['item_class'] AND $r['item_id']){ $r['item'] = $r['item_class']::load($r['item_id']); }; unset($r['item_class'],$r['item_id']); $results[] = $r; } var_dump($results);exit; solved Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.