/** * Get field cliente.fecha_nacimiento from logical database "empresa" as a DateTime object * @return \DateTime */ public function getFechaNacimientoDateTimeObject() { return $this->getDatetimeObjectFromField(self::FECHA_NACIMIENTO_COLUMN, Config::getDatetimeStorageFormat()); }
/** * Return the SQL String * * @param $factory DataAccessObjectFactory * @return string */ public function getSQL(DataAccessObjectFactory $factory) { return $this->field . " COLLATE " . Config::getCaseSenstitiveCollation() . " LIKE " . $factory->escapeString(str_replace("_", "\\_", str_replace("%", "\\%", $this->value))); }
<?php namespace dao\empresaDatabase; include "clases/dao/empresaDatabase/autoload.php"; include "Parm/vendor/autoload.php"; use Parm\Config; Config::setupConnection("empresa", "empresa", "root", "", "localhost"); $type = isset($_POST["type"]) ? $_POST["type"] : null; switch ($type) { case "C": echo ClienteCRUD::Create(new Cliente($_POST["nombres"], $_POST["ciudad"], $_POST["sexo"], $_POST["telefono"], $_POST["fechaNacimiento"])); break; case "R": echo ClienteCRUD::Read(new Cliente($_POST["id"])); break; case "U": echo ClienteCRUD::Update(new Cliente($_POST["id"], $_POST["nombres"], $_POST["ciudad"], $_POST["sexo"], $_POST["telefono"], $_POST["fechaNacimiento"])); break; case "D": echo ClienteCRUD::Delete(new Cliente($_POST["id"])); break; case null: echo ClienteCRUD::All(); break; } class Cliente { var $clienteDAO; function __construct() {
<?php include "Parm/vendor/autoload.php"; \Parm\Config::addConnection('empresa', new Doctrine\DBAL\Connection(['dbname' => 'empresa', 'user' => 'root', 'password' => '', 'host' => 'localhost'], new Doctrine\DBAL\Driver\PDOMySql\Driver(), null, null)); $generator = new Parm\Generator\Generator(Parm\Config::getConnection('empresa'), './clases/dao/empresaDatabase', "dao\\empresaDatabase"); $generator->generate();
/** * Useful for replacing mysql_real_escape_string in old code with DatabaseProcessor::mysql_real_escape_string() */ public static function mysql_real_escape_string($string) { $dp = new DatabaseProcessor(current(Config::getAllConnections())); return $dp->escapeString($string); }