for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Class DbRowDirectOperator
*
* Handle Entity storing/loading operations
*/
class DbRowDirectOperator implements \Common\IEntityOperator {
* @param \Common\IEntity $entity
* @return array
public function getById($entity) {
$stmt = classSupernova::$gc->query
setIdField
\classSupernova::$gc->query
callable
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
->setIdField($entity->getIdFieldName())
->field('*')
->from($entity->getTableName())
->where($entity->getIdFieldName() . ' = "' . $entity->dbId . '"');
dbId
Common\IEntity
instanceof
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Adding an additional type check:
interface SomeInterface { } class SomeClass implements SomeInterface { public $a; } function someFunction(SomeInterface $object) { if ($object instanceof SomeClass) { $a = $object->a; } }
Changing the type hint:
interface SomeInterface { } class SomeClass implements SomeInterface { public $a; } function someFunction(SomeClass $object) { $a = $object->a; }
return $stmt->selectRow();
}
public function deleteById($entity) {
$db = $entity->getDbStatic();
$db->doDeleteRowWhere($entity->getTableName(), array($entity->getIdFieldName() => $entity->dbId));
return $db->db_affected_rows();
public function insert($entity) {
$row = $entity->exportRowWithoutId();
if (empty($row)) {
// TODO Exceptiion
return 0;
$db->doInsertSet($entity->getTableName(), $row);
// TODO Exceptiion if db_insert_id() is empty
return $entity->dbId = $db->db_insert_id();
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.