Doctrine_manual-1-2-en

Chapter 16: Behaviors

Chapter 16: Behaviors 266 Conclusion By now we should know a lot about Doctrine behaviors. We should know how to write our own for our models as well as how to use all the great behaviors that come bundled with Doctrine. Now we are ready to move on to discuss the Searchable (page 267) behavior in more detail in the Searching (page 267) chapter. As it is a large topic we have devoted an entire chapter to it. ----------------- Brought to you by

Chapter 17: Searching 267 Chapter 17 Searching Introduction Searching is a huge topic, hence an entire chapter has been devoted to a behavior called Searchable. It is a fulltext indexing and searching tool. It can be used for indexing and searching both database and files. Consider we have a class called NewsItem with the following definition: // models/NewsItem.php Listing 17-1 class NewsItem extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('title', 'string', 255); $this->hasColumn('body', 'clob'); } } Here is the same example in YAML format. You can read more about YAML in the YAML Schema Files (page 195) chapter: --- # schema.yml Listing 17-2 # ... NewsItem: columns: title: string(255) body: clob Now lets say we have an application where users are allowed to search for different news items, an obvious way to implement this would be building a form and based on that forms submitted values build DQL queries such as: // test.php Listing 17-3 // ... $q = Doctrine_Query::create() ->from('NewsItem i') ->where('n.title LIKE ? OR n.content LIKE ?'); ----------------- Brought to you by

Test4Direct provides latest PDF questions of IBM C2090-610 exam. You have an opportunity to pass the IBM C2090-610 exam in one go. Test4Direct is most accurate source to prepare IBM C2090-610 exam as your success will become site’s responsibility after purchasing C2090-610 exam product. There are also lots of discounts and promotion offers that you can avail. Let’s try a free demo http://www.test4direct.com/C2090-610.html