diff --git a/.gitignore b/.gitignore index 75ee8b3..3db2605 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ README /test/fixtures/project/log/* /test/fixtures/project/data/sql/* /test/fixtures/project/data/sqlite/* -/test/fixtures/project/lib/model/doctrine/base/* +/test/fixtures/project/lib/model/* !.gitignore diff --git a/test/fixtures/project/lib/model/doctrine/AirCompany.class.php b/test/fixtures/project/lib/model/doctrine/AirCompany.class.php deleted file mode 100644 index fd4eb8d..0000000 --- a/test/fixtures/project/lib/model/doctrine/AirCompany.class.php +++ /dev/null @@ -1,15 +0,0 @@ -getTempleteWithInvoker('UnknownTemplate', 'callMe'); - } -} diff --git a/test/fixtures/project/lib/model/doctrine/BlogPostComment.class.php b/test/fixtures/project/lib/model/doctrine/BlogPostComment.class.php deleted file mode 100644 index 9964f72..0000000 --- a/test/fixtures/project/lib/model/doctrine/BlogPostComment.class.php +++ /dev/null @@ -1,15 +0,0 @@ -createQuery('bpc') : clone $q; - } - - /** - * Adds all BlogPostCommentTable columns to the query - * - * @param Doctrine_Query $q - * @return {$TableName}Table - */ - public function addSelectTableColumns (Doctrine_Query $q) - { - $q->addSelect("{$q->getRootAlias()}.*"); - - return $this; - } - - /** - * Default getQuery method to work directly with Doctrine_Query object - * - * @param Doctrine_Query $q - * @return Doctrine_Query - */ - public function getQuery (Doctrine_Query $q = null) - { - $q = $this->createQueryIfNull($q); - - $this - ->addSelectTableColumns($q) - ; - - return $q; - } - - /** - * Method to fetch query with predefined filters - * - * @param Doctrine_Query $q - * @return BlogPostCommentTable - */ - public function get (Doctrine_Query $q = null) - { - $q = $this->getQuery($q); - - return $this; - } - - -} diff --git a/test/fixtures/project/lib/model/doctrine/BlogPostTable.class.php b/test/fixtures/project/lib/model/doctrine/BlogPostTable.class.php deleted file mode 100644 index 45f0570..0000000 --- a/test/fixtures/project/lib/model/doctrine/BlogPostTable.class.php +++ /dev/null @@ -1,149 +0,0 @@ -createQuery('bp') : clone $q; - } - - /** - * Adds all BlogPostTable columns to the query - * - * @param Doctrine_Query $q - * @return {$TableName}Table - */ - public function addSelectTableColumns (Doctrine_Query $q) - { - $q->addSelect("{$q->getRootAlias()}.*"); - - return $this; - } - - /** - * Adds count by foreign table as %foreign_table_name%_count column - * - * @return BlogPostCommentTable - */ - public function addSelectBlogPostCommentCount (Doctrine_Query $q) - { - $subq = $q->createSubquery() - ->select('count(bpcc.blog_post_id)') - ->from('BlogPostComment bpcc') - ->where("{$q->getRootAlias()}.id = bpcc.blog_post_id") - ; - - $subModelNameTableized = Doctrine_Inflector::tableize('BlogPostComment'); - - $q->addSelect("({$subq->getDql()}) {$subModelNameTableized}_count"); - - return $this; - } - - /** - * Adds join to the BlogPostCommentTable and adds its columns to SELECT block - * - * @param Doctrine_Query $q - * @return BlogPostTable - */ - public function withBlogPostComment (Doctrine_Query $q) - { - $q - ->addSelect('bpc.*') - ->leftJoin("{$q->getRootAlias()}.BlogPostComment bpc") - ; - - return $this; - } - - - /** - * - * @param Doctine_Query $q - * @return Doctine_Query - */ - public function getPostsWithCommentQuery (Doctine_Query $q = null) - { - $q = $this->getPostsQuery($q); - - $this - ->withBlogPostComment($q) - ; - - return $q; - } - - /** - * Adds Translation table to BlogPostTable with specified culture (or system-user culture) - * - * @param Doctrine_Query $q - * @param string $culture Lowercased culture code - * @return BlogPostTable - */ - public function withI18n (Doctrine_Query $q, $culture = null) - { - $culture = is_null($culture) ? sfContext::getInstance()->getUser()->getCulture() : $culture; - - $q - ->addSelect("{$q->getRootAlias()}t.*") - ->leftJoin( - "{$q->getRootAlias()}.Translation {$q->getRootAlias()}t WITH {$q->getRootAlias()}t.lang = ?", - $culture - ) - ; - - return $this; - } - - /** - * - * @param Doctine_Query $q - * @return Doctine_Query - */ - public function getPostsWithCommentAndCountQuery (Doctine_Query $q = null) - { - $q = $this->getPostsQuery($q); - - $this - ->addSelectBlogPostCommentCount($q) - ->withBlogPostComment($q) - ; - - return $q; - } - - /** - * - * @param Doctine_Query $q - * @return Doctine_Query - */ - public function getPostsQuery (Doctine_Query $q = null) - { - $q = $this->createQueryIfNull($q); - - $q->orderBy('id asc')->addWhere('is_enabled = 1'); - - $this - ->addSelectTableColumns($q) - ->withI18n($q) - ; - - return $q; - } -} diff --git a/test/fixtures/project/lib/model/doctrine/BlogPostVote.class.php b/test/fixtures/project/lib/model/doctrine/BlogPostVote.class.php deleted file mode 100644 index 0c69c09..0000000 --- a/test/fixtures/project/lib/model/doctrine/BlogPostVote.class.php +++ /dev/null @@ -1,15 +0,0 @@ -