Symfony
Links
Code snippets
Database Model
Command to recreate the database model to xml and create the php model from the xml to /lib. Note: you CANNOT have a .schema.yml file in your main config folder for this to work.
symfony propel-build-schema xml
symfony propel-build-model
Propel custom sql query
This code allows a custom sql query using propel within symfony.
$query = "Select some query where year = ? and name = ?";
$con = Propel::getConnection();
$stmt = $con->prepareStatement($query);
$stmt->setInt(1, $year);
$stmt->setString(2, $name);
$rs = $stmt->executeQuery();
while ($rs->next()){
//store your results here using an array or objects
//$arrayOrObject = $rs->getInt("fieldName");
}
Get array of objects with the ID as the key
This code will get all of the objects from a Peer Class with the id being the key. This is very useful to be able to "lookup" the object you may want.
public static function retrieveArrayById($c = null){
if(is_null($c)) $c = new Criteria;
$objects = self::doSelect($c);
$outObjects = array();
foreach($objects as $object){
$outObjects[$object->getId()] = $object;
}
return $outObjects;
}
Wells Ideas Inc. launches their redesigned site.
The site is built on a symfony platform and utilizes client information from their project management site.
- Phillip Knight
Contact Us | Site Map | Open Source Solutions | Templates | Client Login
