/build/classes/tugasku/om/BaseCobaQuery.php

https://bitbucket.org/faisaluje/tugasku · PHP · 320 lines · 137 code · 21 blank · 162 comment · 21 complexity · 86f1c88cdbc91b6b9ccf242091c134b2 MD5 · raw file

  1. <?php
  2. /**
  3. * Base class that represents a query for the 'coba' table.
  4. *
  5. *
  6. *
  7. * @method CobaQuery orderByCobaId($order = Criteria::ASC) Order by the coba_id column
  8. * @method CobaQuery orderByNama($order = Criteria::ASC) Order by the nama column
  9. * @method CobaQuery orderByDeskripsi($order = Criteria::ASC) Order by the deskripsi column
  10. * @method CobaQuery orderByJabatanId($order = Criteria::ASC) Order by the jabatan_id column
  11. *
  12. * @method CobaQuery groupByCobaId() Group by the coba_id column
  13. * @method CobaQuery groupByNama() Group by the nama column
  14. * @method CobaQuery groupByDeskripsi() Group by the deskripsi column
  15. * @method CobaQuery groupByJabatanId() Group by the jabatan_id column
  16. *
  17. * @method CobaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
  18. * @method CobaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
  19. * @method CobaQuery innerJoin($relation) Adds a INNER JOIN clause to the query
  20. *
  21. * @method CobaQuery leftJoinJabatan($relationAlias = null) Adds a LEFT JOIN clause to the query using the Jabatan relation
  22. * @method CobaQuery rightJoinJabatan($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Jabatan relation
  23. * @method CobaQuery innerJoinJabatan($relationAlias = null) Adds a INNER JOIN clause to the query using the Jabatan relation
  24. *
  25. * @method Coba findOne(PropelPDO $con = null) Return the first Coba matching the query
  26. * @method Coba findOneOrCreate(PropelPDO $con = null) Return the first Coba matching the query, or a new Coba object populated from the query conditions when no match is found
  27. *
  28. * @method Coba findOneByCobaId(int $coba_id) Return the first Coba filtered by the coba_id column
  29. * @method Coba findOneByNama(string $nama) Return the first Coba filtered by the nama column
  30. * @method Coba findOneByDeskripsi(string $deskripsi) Return the first Coba filtered by the deskripsi column
  31. * @method Coba findOneByJabatanId(int $jabatan_id) Return the first Coba filtered by the jabatan_id column
  32. *
  33. * @method array findByCobaId(int $coba_id) Return Coba objects filtered by the coba_id column
  34. * @method array findByNama(string $nama) Return Coba objects filtered by the nama column
  35. * @method array findByDeskripsi(string $deskripsi) Return Coba objects filtered by the deskripsi column
  36. * @method array findByJabatanId(int $jabatan_id) Return Coba objects filtered by the jabatan_id column
  37. *
  38. * @package propel.generator.tugasku.om
  39. */
  40. abstract class BaseCobaQuery extends ModelCriteria
  41. {
  42. /**
  43. * Initializes internal state of BaseCobaQuery object.
  44. *
  45. * @param string $dbName The dabase name
  46. * @param string $modelName The phpName of a model, e.g. 'Book'
  47. * @param string $modelAlias The alias for the model in this query, e.g. 'b'
  48. */
  49. public function __construct($dbName = 'tugasku', $modelName = 'Coba', $modelAlias = null)
  50. {
  51. parent::__construct($dbName, $modelName, $modelAlias);
  52. }
  53. /**
  54. * Returns a new CobaQuery object.
  55. *
  56. * @param string $modelAlias The alias of a model in the query
  57. * @param Criteria $criteria Optional Criteria to build the query from
  58. *
  59. * @return CobaQuery
  60. */
  61. public static function create($modelAlias = null, $criteria = null)
  62. {
  63. if ($criteria instanceof CobaQuery) {
  64. return $criteria;
  65. }
  66. $query = new CobaQuery();
  67. if (null !== $modelAlias) {
  68. $query->setModelAlias($modelAlias);
  69. }
  70. if ($criteria instanceof Criteria) {
  71. $query->mergeWith($criteria);
  72. }
  73. return $query;
  74. }
  75. /**
  76. * Find object by primary key
  77. * Use instance pooling to avoid a database query if the object exists
  78. * <code>
  79. * $obj = $c->findPk(12, $con);
  80. * </code>
  81. * @param mixed $key Primary key to use for the query
  82. * @param PropelPDO $con an optional connection object
  83. *
  84. * @return Coba|array|mixed the result, formatted by the current formatter
  85. */
  86. public function findPk($key, $con = null)
  87. {
  88. if ((null !== ($obj = CobaPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
  89. // the object is alredy in the instance pool
  90. return $obj;
  91. } else {
  92. // the object has not been requested yet, or the formatter is not an object formatter
  93. $criteria = $this->isKeepQuery() ? clone $this : $this;
  94. $stmt = $criteria
  95. ->filterByPrimaryKey($key)
  96. ->getSelectStatement($con);
  97. return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
  98. }
  99. }
  100. /**
  101. * Find objects by primary key
  102. * <code>
  103. * $objs = $c->findPks(array(12, 56, 832), $con);
  104. * </code>
  105. * @param array $keys Primary keys to use for the query
  106. * @param PropelPDO $con an optional connection object
  107. *
  108. * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
  109. */
  110. public function findPks($keys, $con = null)
  111. {
  112. $criteria = $this->isKeepQuery() ? clone $this : $this;
  113. return $this
  114. ->filterByPrimaryKeys($keys)
  115. ->find($con);
  116. }
  117. /**
  118. * Filter the query by primary key
  119. *
  120. * @param mixed $key Primary key to use for the query
  121. *
  122. * @return CobaQuery The current query, for fluid interface
  123. */
  124. public function filterByPrimaryKey($key)
  125. {
  126. return $this->addUsingAlias(CobaPeer::COBA_ID, $key, Criteria::EQUAL);
  127. }
  128. /**
  129. * Filter the query by a list of primary keys
  130. *
  131. * @param array $keys The list of primary key to use for the query
  132. *
  133. * @return CobaQuery The current query, for fluid interface
  134. */
  135. public function filterByPrimaryKeys($keys)
  136. {
  137. return $this->addUsingAlias(CobaPeer::COBA_ID, $keys, Criteria::IN);
  138. }
  139. /**
  140. * Filter the query on the coba_id column
  141. *
  142. * @param int|array $cobaId The value to use as filter.
  143. * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
  144. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  145. *
  146. * @return CobaQuery The current query, for fluid interface
  147. */
  148. public function filterByCobaId($cobaId = null, $comparison = null)
  149. {
  150. if (is_array($cobaId) && null === $comparison) {
  151. $comparison = Criteria::IN;
  152. }
  153. return $this->addUsingAlias(CobaPeer::COBA_ID, $cobaId, $comparison);
  154. }
  155. /**
  156. * Filter the query on the nama column
  157. *
  158. * @param string $nama The value to use as filter.
  159. * Accepts wildcards (* and % trigger a LIKE)
  160. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  161. *
  162. * @return CobaQuery The current query, for fluid interface
  163. */
  164. public function filterByNama($nama = null, $comparison = null)
  165. {
  166. if (null === $comparison) {
  167. if (is_array($nama)) {
  168. $comparison = Criteria::IN;
  169. } elseif (preg_match('/[\%\*]/', $nama)) {
  170. $nama = str_replace('*', '%', $nama);
  171. $comparison = Criteria::LIKE;
  172. }
  173. }
  174. return $this->addUsingAlias(CobaPeer::NAMA, $nama, $comparison);
  175. }
  176. /**
  177. * Filter the query on the deskripsi column
  178. *
  179. * @param string $deskripsi The value to use as filter.
  180. * Accepts wildcards (* and % trigger a LIKE)
  181. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  182. *
  183. * @return CobaQuery The current query, for fluid interface
  184. */
  185. public function filterByDeskripsi($deskripsi = null, $comparison = null)
  186. {
  187. if (null === $comparison) {
  188. if (is_array($deskripsi)) {
  189. $comparison = Criteria::IN;
  190. } elseif (preg_match('/[\%\*]/', $deskripsi)) {
  191. $deskripsi = str_replace('*', '%', $deskripsi);
  192. $comparison = Criteria::LIKE;
  193. }
  194. }
  195. return $this->addUsingAlias(CobaPeer::DESKRIPSI, $deskripsi, $comparison);
  196. }
  197. /**
  198. * Filter the query on the jabatan_id column
  199. *
  200. * @param int|array $jabatanId The value to use as filter.
  201. * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
  202. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  203. *
  204. * @return CobaQuery The current query, for fluid interface
  205. */
  206. public function filterByJabatanId($jabatanId = null, $comparison = null)
  207. {
  208. if (is_array($jabatanId)) {
  209. $useMinMax = false;
  210. if (isset($jabatanId['min'])) {
  211. $this->addUsingAlias(CobaPeer::JABATAN_ID, $jabatanId['min'], Criteria::GREATER_EQUAL);
  212. $useMinMax = true;
  213. }
  214. if (isset($jabatanId['max'])) {
  215. $this->addUsingAlias(CobaPeer::JABATAN_ID, $jabatanId['max'], Criteria::LESS_EQUAL);
  216. $useMinMax = true;
  217. }
  218. if ($useMinMax) {
  219. return $this;
  220. }
  221. if (null === $comparison) {
  222. $comparison = Criteria::IN;
  223. }
  224. }
  225. return $this->addUsingAlias(CobaPeer::JABATAN_ID, $jabatanId, $comparison);
  226. }
  227. /**
  228. * Filter the query by a related Jabatan object
  229. *
  230. * @param Jabatan $jabatan the related object to use as filter
  231. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  232. *
  233. * @return CobaQuery The current query, for fluid interface
  234. */
  235. public function filterByJabatan($jabatan, $comparison = null)
  236. {
  237. return $this
  238. ->addUsingAlias(CobaPeer::JABATAN_ID, $jabatan->getJabatanId(), $comparison);
  239. }
  240. /**
  241. * Adds a JOIN clause to the query using the Jabatan relation
  242. *
  243. * @param string $relationAlias optional alias for the relation
  244. * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
  245. *
  246. * @return CobaQuery The current query, for fluid interface
  247. */
  248. public function joinJabatan($relationAlias = null, $joinType = Criteria::INNER_JOIN)
  249. {
  250. $tableMap = $this->getTableMap();
  251. $relationMap = $tableMap->getRelation('Jabatan');
  252. // create a ModelJoin object for this join
  253. $join = new ModelJoin();
  254. $join->setJoinType($joinType);
  255. $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
  256. if ($previousJoin = $this->getPreviousJoin()) {
  257. $join->setPreviousJoin($previousJoin);
  258. }
  259. // add the ModelJoin to the current object
  260. if($relationAlias) {
  261. $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
  262. $this->addJoinObject($join, $relationAlias);
  263. } else {
  264. $this->addJoinObject($join, 'Jabatan');
  265. }
  266. return $this;
  267. }
  268. /**
  269. * Use the Jabatan relation Jabatan object
  270. *
  271. * @see useQuery()
  272. *
  273. * @param string $relationAlias optional alias for the relation,
  274. * to be used as main alias in the secondary query
  275. * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
  276. *
  277. * @return JabatanQuery A secondary query class using the current class as primary query
  278. */
  279. public function useJabatanQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
  280. {
  281. return $this
  282. ->joinJabatan($relationAlias, $joinType)
  283. ->useQuery($relationAlias ? $relationAlias : 'Jabatan', 'JabatanQuery');
  284. }
  285. /**
  286. * Exclude object from result
  287. *
  288. * @param Coba $coba Object to remove from the list of results
  289. *
  290. * @return CobaQuery The current query, for fluid interface
  291. */
  292. public function prune($coba = null)
  293. {
  294. if ($coba) {
  295. $this->addUsingAlias(CobaPeer::COBA_ID, $coba->getCobaId(), Criteria::NOT_EQUAL);
  296. }
  297. return $this;
  298. }
  299. } // BaseCobaQuery