Symfony Helpful Query
Select all not null column from the TblCms Table. The criteria ISNOTNULL is used to get not empty column from the table.
$cri = new Criteria();
$cri->add(TblCmsPeer::id, $c->getId());
$cri->add(TblCmsPeer::insertedBy, NULL,Criteria::ISNOTNULL);
$this->selOne = TblCmsPeer::doSelectOne($cri);
Here $myId is the variable which compares the value with table value and This query should return the expect this id rows of data.
$cri = new Criteria();
$cri->add(TblCmsPeer::id, $c->getId());
$cri->add(TblCmsPeer::insertedBy, $myId,Criteria::NOT_EQUAL);
$this->selOne = TblCmsPeer::doSelectOne($cri);
This will search $search_title = “welcome nepal” from the database column.
$cri = new Criteria();
$cri->add(TblCmsPeer::id, $c->getId());
$cri->add(TblCmsPeer::title,$search_title,Criteria::LIKE);
$this->selOne = TblCmsPeer::doSelectOne($cri);
Or Condition in Query Symfony:
$c = new Criteria();
$c->add(ForwardedPharmacyDeletedLogPeer::CURRENTLY, ‘1’);
$cc = $c->getNewCriterion(ForwardedPharmacyDeletedLogPeer::FORWARDED_TO,$userId);
$c2 = $c->getNewCriterion(ForwardedPharmacyDeletedLogPeer::REVERTED_TO,$userId);
$cc->addOr($c2);
$c->add($cc);
$my_assigned_pharmacy_list = ForwardedPharmacyDeletedLogPeer::doSelect($c);
Or Condition result
More Criterias :
EQUAL | Comparison type. |
NOT_EQUAL | Comparison type. |
ALT_NOT_EQUAL | Comparison type. |
GREATER_THAN | Comparison type. |
LESS_THAN | Comparison type. |
GREATER_EQUAL | Comparison type. |
LESS_EQUAL | Comparison type. |
LIKE | Comparison type. |
NOT_LIKE | Comparison type. |
CONTAINS_ALL | Comparison for array column types |
CONTAINS_SOME | Comparison for array column types |
CONTAINS_NONE | Comparison for array column types |
ILIKE | PostgreSQL comparison type |
NOT_ILIKE | PostgreSQL comparison type |
CUSTOM | Comparison type. |
CUSTOM_EQUAL | Comparison type for update |
DISTINCT | Comparison type. |
IN | Comparison type. |
NOT_IN | Comparison type. |
ALL | Comparison type. |
JOIN | Comparison type. |
BINARY_AND | Binary math operator: AND |
BINARY_OR | Binary math operator: OR |
ASC | “Order by” qualifier – ascending |
DESC | “Order by” qualifier – descending |
ISNULL | “IS NULL” null comparison |
ISNOTNULL | “IS NOT NULL” null comparison |
CURRENT_DATE | “CURRENT_DATE” ANSI SQL function |
CURRENT_TIME | “CURRENT_TIME” ANSI SQL function |
CURRENT_TIMESTAMP | “CURRENT_TIMESTAMP” ANSI SQL function |
LEFT_JOIN | “LEFT JOIN” SQL statement |
RIGHT_JOIN | “RIGHT JOIN” SQL statement |
INNER_JOIN | “INNER JOIN” SQL statement |
LOGICAL_OR | logical OR operator |
LOGICAL_AND | logical AND operator |