/** The awesome find function. Creates a QueryBuilder Object wich creates a Query to find all objects for your filters. * <code> * // Syntax for the filters array: * Array( * 'ID > 500', // just a key element, it will detect this, map the fields and just execute it. * 'property'=> 'value' // $property of $classname has to be $value * Array('ClassName'=> array('property'=>'value')// Filter by a (relational) class's property. You can use this recursively!! * ) * </code> * @param string $className Classname to find (has to be a relation of $this or get_class($this)) * @param array $filters array of filters to use in query * @param array $extra array of eventual order by / group by parameters * @param array $justThese Fetch only these fields from the table. Useful if you don't want to fetch large text or blob columns. * @uses QueryBuilder to build the actual query * @returns array a batch of pre-filled objects of $className or false if it finds nothing */ public function Find($className, $filters = array(), $extra = array(), $justThese = array()) { $originalClassName = $className instanceof dbObject ? get_class($className) : $className; $class = new $originalClassName(); if ($originalClassName != get_class($this) && $this->ID != false) { $filters["ID"] = $this->ID; $filters = array(get_class($this) => $filters); } $builder = new QueryBuilder($originalClassName, $filters, $extra, $justThese); $input = dbConnection::getInstance($this->databaseInfo->connection)->fetchAll($builder->buildQuery(), 'assoc'); return dbObject::importArray($originalClassName, $input); }