PHP code example of bradchesney79 / propel3
1. Go to this page and download the library: Download bradchesney79/propel3 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bradchesney79 / propel3 example snippets
namespace Vendor
use Propel\Annotations\Entity;
use Propel\Annotations\Field;
use Propel\Annotations\PrimaryKey;
/**
* @Entity()
*/
class Car
{
/**
* @PrimaryKey(auto_increment=true)
*/
private $id;
/**
* @Field(type="VARCHAR")
*/
private $name;
// getters/setters
}
$propel = new Propel\Runtime\Configuration('path/to/propel.yml');
// Name('Ford');
$session->persist($car);
$session->commit();
// use <entity name="Vendor\Car" activeRecord="true">
$car = new Vendor\Car();
$car->setName('Ford');
$car->save();